http://qs1969.pair.com?node_id=942460


in reply to system command is not working

I can recreate your problem now.

me@mybox:/home/me/sandbox $ cat 1.pl #!/usr/bin/perl system('echo bob >/tmp/blarney.out'); me@mybox:/home/me/sandbox $ ./1.pl me@mybox:/home/me/sandbox $ cat /tmp/blarney.out bob me@mybox:/home/me/sandbox $ rm /tmp/blarney.out me@mybox:/home/me/sandbox $ at -f 1.pl now Job me.1323356661.a will be run at Thu Dec 8 10:04:21 EST 2011. me@mybox:/home/me/sandbox $ at -l me@mybox:/home/me/sandbox $ ls -l /tmp/blarney.out ls: 0653-341 The file /tmp/blarney.out does not exist.

When I check my mail, I see the problem. Notice the "command not found" message. This means you must supply full path to the script.

me@mybox:/home/me/sandbox $ mail Mail [5.2 UCB] [AIX 5.X] Type ? for help. "/var/spool/mail/me": 2 messages 1 new 2 unread U 1 daemon Thu Dec 8 10:02 32/950 "Output from at job +1.pl, me" >N 2 daemon Thu Dec 8 10:04 31/940 "Output from at job +1.pl, me" ? 1 Message 1: From daemon Thu Dec 8 10:02:08 2011 Date: Thu, 8 Dec 2011 10:02:08 -0500 From: daemon To: me Subject: Output from at job 1.pl, me@mybox, exit status 127 Cron Environment: SHELL = /opt/freeware/bin/bash PATH=/usr/bin:/etc:/usr/sbin:/usr/bin/X11:/sbin:/usr/java14/jre/bin:/ +usr/java14/bin:/usr/local/bin CRONDIR=/var/spool/cron/crontabs ATDIR=/var/spool/cron/atjobs LOGNAME=me HOME=/home/me Your "at" job executed on mybox on Thu Dec 8 10:02:08 EST 2011 1.pl produced the following output: bash: line 3: 1.pl: command not found ***************************************************************** cron: The previous message is the standard output and standard error of one of the cron commands.

Now with full path supplied.

me@mybox:/home/me/sandbox $ ls -l /tmp/blarney.out ls: 0653-341 The file /tmp/blarney.out does not exist. me@mybox:/home/me/sandbox $ at -f /home/me/sandbox/1.pl now Job me.1323356887.a will be run at Thu Dec 8 10:08:07 EST 2011. me@mybox:/home/me/sandbox $ at -l me@mybox:/home/me/sandbox $ ls -l /tmp/blarney.out -rw-r----- 1 me users 4 Dec 08 10:08 /tmp/blarney.out