0

I want to schedule task to run perl script every week in Win task sceduler. The perl script is running manually from command line using:

perl update_blastdb.pl --passive --decompress refseq_rna

How can I pass the above 3 arguments:

--passive --decompress refseq_rna

Edit1: I wrote a bat file that contains:

@echo off
cd "C:\inetpub\wwwroot\webclient\db\nucleotide"
call "C:\Strawberry\perl\bin\perl.exe" "C:\inetpub\wwwroot\webclient\db\nucleotide\update_blastdb.pl" --passive --decompress gss_annot> C:\perl_out.log 2>&1

I schedule task in Win task scheduler to run the bat file. First, when I specify a time to run it, the time come and go and the task doesn't run (status: Ready). Second, when I run the task manually by right click the task and click run, the status change to (Running) but, it seems that it doesn't run because I check the error log I create,perl_out.log, and a found it doesn't created.

Any clarification please?

Edit3: it ran successfully when I create the task as "basic task". Thanks

Alaa
  • 185
  • 5
  • 14

1 Answers1

3

You want the Scheduled Task executable to simply be "perl", and ALL the rest (including the Perl script) goes into the Arguments. Args are specified differently depending on the Windows version, so you'll need to look that part up, but it's all right there in the Task GUI.

A couple other suggestions:

  1. Make a DOS batch script "wrapper" around your command. BAT scripts are easier to specify in the Task GUI, and easier for the admin to launch manually too.
  2. Also consider redirecting standard output and standard error to a log file, so you can monitor what's going on. Sometimes this is required just to debug a problem with launching the Task (like a problem with Perl or the Perl script).
  3. For bonus points, monitor the log file(s) in a separate program, so you can be notified immediately if something is wrong.

Edit: Adding details about the Task setup, per the op's edit.

Do all the redirection in the Task setup, not inside the BAT script. I don't find it necessary to include call in mt BAT wrappers, nor to even explicitly include perl.exe.

Here's an example Task setup: enter image description here

Here's an example BAT wrapper:

@echo off

date/t
time/t

echo.
disk_space.pl C:
disk_space.pl D:

echo.
echo Done.
exit/b
jimtut
  • 2,366
  • 2
  • 16
  • 37