Help with crontab & script
I have a script I use to check the state of machine, when I run it from the /jobtrig directory it runs fine as "root". When I add the entry to crontab as "root" using syntax crontab -e: # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.9682 installed on Wed May 21 22:19:53 2003) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) #minute hour mday month wday command 00 23 * * * cd /jobtrig && sh sweeper > sdtrace.log <-- word wrapping in Outlook I get this in an email: ./sweep: sdsweep: command not found But when I do an "ls" on the /jobtrig directory I see all the files: drwxr-xr-x 2 0 0 128 May 21 22:19 . drwxr-xr-x 25 0 0 656 May 21 22:18 .. -rw-r--r-- 1 0 0 0 Jun 12 23:00 sdtrace.log -rwxr-xr-x 1 0 0 15 May 21 22:18 sweep -rwxr-xr-x 1 0 0 860 May 21 22:18 sweeper What am I doing wrong? -Sean
On Fri, 2003-06-13 at 12:30, Sean M Lentner wrote:
I have a script I use to check the state of machine, when I run it from the /jobtrig directory it runs fine as "root". When I add the entry to crontab as "root" using syntax crontab -e:
# DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.9682 installed on Wed May 21 22:19:53 2003) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) #minute hour mday month wday command 00 23 * * * cd /jobtrig && sh sweeper > sdtrace.log <-- word wrapping in Outlook
I get this in an email:
./sweep: sdsweep: command not found
But when I do an "ls" on the /jobtrig directory I see all the files:
drwxr-xr-x 2 0 0 128 May 21 22:19 . drwxr-xr-x 25 0 0 656 May 21 22:18 .. -rw-r--r-- 1 0 0 0 Jun 12 23:00 sdtrace.log -rwxr-xr-x 1 0 0 15 May 21 22:18 sweep -rwxr-xr-x 1 0 0 860 May 21 22:18 sweeper
I don't see sdsweep there
What am I doing wrong?
when you run things from crontab, by default they have a *very* limited $PATH. You could have a line in your crontab file like PATH=/usr/bin:/usr/local/bin:/path/to/my/commands or you could start your script with a line like that. Or you could give the absolute path to all commands you use in your script.
On Fri, Jun 13, 2003 at 06:30:58AM -0400, Sean M Lentner Wrote:
I have a script I use to check the state of machine, when I run it from the /jobtrig directory it runs fine as "root". When I add the entry to crontab as "root" using syntax crontab -e:
# DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.9682 installed on Wed May 21 22:19:53 2003) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) #minute hour mday month wday command 00 23 * * * cd /jobtrig && sh sweeper > sdtrace.log <-- word wrapping in Outlook
I get this in an email:
./sweep: sdsweep: command not found
But when I do an "ls" on the /jobtrig directory I see all the files:
drwxr-xr-x 2 0 0 128 May 21 22:19 . drwxr-xr-x 25 0 0 656 May 21 22:18 .. -rw-r--r-- 1 0 0 0 Jun 12 23:00 sdtrace.log -rwxr-xr-x 1 0 0 15 May 21 22:18 sweep -rwxr-xr-x 1 0 0 860 May 21 22:18 sweeper
What am I doing wrong?
-Sean
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
Try giving the script execute permission, and use the absolute path: 00 23 * * * /jobtrig/sweeper >sdtrace.log -- _ _ __ _____ _____ ___| |_ | '__| / __\ \ /\ / / _ \/ _ \ __| -o) | | _ \__ \\ V V / __/ __/ |_ /\\ |_|(_) |___/ \_/\_/ \___|\___|\__|_\_v rsweet@garagenetworks.net "there's no love in fear."
participants (3)
-
Anders Johansson
-
Robert Sweet
-
Sean M Lentner