0

I have a an rsync(cwrsync) batch file set up to run, backing up several directories daily to a backup server via ssh.

I set this batch file to run as a scheduled task, however it does not seem to.

Things run perfectly if I run the batch file while logged on, however I can not get it to run as a scheduled task. If I am logged on or not makes no differences. I also get no error listed in event log, indicating the schedule task does execute, but the batch file does not for some reason.

3
  • have a feeling its an issue with the credentials for the ssh component – tony roth Nov 29 '10 at 20:51
  • credentials are just key based, which I specify in the batch file – Jim Nov 30 '10 at 9:09
  • its usually a credential pair as in the key and the user but the user is different when you run it as a scheduled task the pair is not complete in this case. – tony roth Nov 30 '10 at 16:15
1

Windows Scheduled Tasks run as a special system user by default (can't remember the exact name, something like LocalSystem?), but that user typically does not have the same environment or privileges as a regular user of the system. Without knowing more detail, it is difficult to tell what is actually going wrong with your Task, so I'll just mention a couple of ideas.

It is possible that your batch script accesses a mapped drive letter that is only defined to you, and so the script fails when run as the special "Scheduled Task" user. Another possibility is that your script accesses network shares, and I believe that the "Scheduled Task" user does not normally have the privilege to access those.

Finally, you could try redirecting the output of the commands in your batch script to a text file. That could be as simple as appending something like >> C:\myscriptlogfile.txt to every line in your script. Examining the output of a failed run may give you some clues about what is going wrong.

0

Another thing to check - is the command wrapped in quotes?

There is an issue in Server 2008 which prevents scheduled tasks from running if the command line is wrapped in quotes. (I'm not sure whether it's been fixed in R2 though)

You can often work around it by converting the command line to old 8.3 style paths (e.g. C:\progra~1\ etc.)

See the KB article for details and a hotfix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.