I will try a better explanation:
The Perl code is simply this one:
system "rsync --version";
It is locate in a file:
backup.pl
From MS DOS prompt (I mean: perl -w backup.pl),
It works fine and shows rsync version.
The same code in the same file
had that error:
(2 main rsync 4008 C:\Programmi\cwRsync\bin\rsync.exe: *** fata
+l error - couldn't initialize fd 0 for /dev/console)
if I try to run the same backup.pl file from Windows Scheduled Task.
That's strange.
| [reply] [d/l] |
Chances are thta this is a "permissions problem". Ie. You have set the task up to run when there is no user logged on, but failed to supply the appropriate user-id / password. .
But, it could also be a lack of a console, try system "cmd /c rsync --version";
| [reply] [d/l] |
system "cmd /c rsync --version";
I have always:
2 main rsync 3456 C:\Programmi\cwRsync\bin\rsync.exe: *** fatal error - couldn't initialize fd 0 for /dev/console
| [reply] [d/l] |
That's strange.
That rsync wants a console, that scheduled tasks are run in the background, or that rsync can't find a non-existent console? The first isn't particularly strange, and the second and third sure aren't.
Can rsync be told to work despite having no console? Does the scheduler give an option to run a task "interactively"?
| [reply] [d/l] [select] |
Okay. First, I assume you are using Win XP or Vista, right? The "MS DOS prompt" has been a command shell for quite a while. But anyway, does your code change to the correct directory? The scheduled copy might be starting in a default directory (like your user folder), and thus be in the wrong place.
I don't think this is Perl problem, since you've demonstrated it works. I suspect it's either a permission problem, or it's starting in the wrong directory. Try checking the current directory from the script that's being run from the Windows Task Scheduler. Also try adding some lines to create or delete files, along with the result.
--marmot
| [reply] |