Help - Search - Members - Calendar
Full Version: Having Problem Running A Cronjob
Linuxhelp > Support > Technical Support
Robert83
Hello

I'm trying to run the following script which runs ok if I execute it via /home/sarg/sarg
CODE
#!/bin/bash

# Get current day

TODAY=$(date +%d/%m/%Y)

# Get one week ago today

LASTWEEK=$(date --date "7 days ago" +%d/%m/%Y)

/usr/bin/sarg -d $LASTWEEK-$TODAY

exit 0


the crontab -l (looks like this)
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 3,9,15,21 * * * /usr/bin/rdate -s time.nist.gov
27 0 * * 2 root /home/sarg/sarg


the /var/log/cron shows that the cronjob ran at the time it was specified but nothing happened (if I run the script manualy it works), what did I mess up here?

Sincerely
Robert B
Robert83
Hi,

modified my cronjob to this

0 3,9,15,21 * * * /usr/bin/rdate -s time.nist.gov
15 23 * * 1 /home/sarg/sarg

and it works now smile.gif (why was that root a problem???) (I tried removing that path above before but did not solve the problem...why was root in the way?) (/home/sarg/sarg is accessible by root)

can someone explain why is it working now smile.gif ?

Sincerely
Robert B
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.