I am seeing a very odd problem when running Perl scripts as cron jobs.
Here are two test scripts, the cron entry, the output, and some strace
output. I apologize for approaching the kernel-list, but the problem
appears to be Linux-specific, since this works on SunOS, Solaris, PTX.
It also appears to be x86-specific, since it works fine on S/Linux
with the same versions of programs.
gerry:~% cat test1
#!/usr/local/bin/perl
$greeting = `/home/agriffis/test2`;
print "Exit status was $?; errno is $!\n" if $?;
print $greeting;
gerry:~% cat test2
#!/usr/local/bin/perl
print("hi there");
exit(0);
gerry:~% ./test1
hi there
Simple enough, right? The crontab entry is
* * * * * $HOME/test1
On SPARC, I just get
hi there
in my mail once per minute, which is correct, but on x86 I get
Exit status was -1; errno is No child processes
hi there
Here is the (short) diff of the strace outputs running at the
command-line and in the crontab. I think the key is the difference
in the wait4 lines, but I lack the expertise to understand why it
would be returning ECHILD when running out of cron.
1c1
< execve("./test1", ["./test1"], [/* 21 vars */]) = 0
--- > execve("/home/agriffis/test1", ["/home/agriffis/test1"], [/* 9 vars */]) = 0 68,69c68,69 < getpid() = 5026 < getpid() = 5026--- > getpid() = 5032 > getpid() = 5032 83c83 < time([903041025]) = 903041025--- > time([903041040]) = 903041040 86c86 < open("./test1", O_RDONLY) = 3--- > open("/home/agriffis/test1", O_RDONLY) = 3 90a91 > getpid() = 5032 92,93d92 < getpid() = 5026 < brk(0x80d2000) = 0x80d2000 102c101 < fork() = 5027--- > fork() = 5034 117c116 < wait4(5027, [WIFEXITED(s) && WEXITSTATUS(s) == 0], 0, NULL) = 5027--- > wait4(5034, 0xbffffab8, 0, NULL) = -1 ECHILD (No child processes) I would appreciate any feedback on this. I am running glibc-2.0.7-19, vixie-cron-3.0.1-24, and perl-5.004-6, all from RH 5.1. I have tried both 2.1 and 2.0 kernels.-Aron
+------------------------------------> | Aron Griffis <agriffis@coat.com> | BCFW Network Group +------------------------------------>
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html