Koozali.org: home of the SME Server
Contribs.org Forums => General Discussion => Topic started by: basmistry on August 21, 2008, 04:32:02 PM
-
I've added a file called
bakk - to /etc/cron.d
The file contains
00 22 * * * root /sbin/bak1
00 23 * * * root /sbin/bak2
Then in /sbin I have bak1 & bak2 - with chmod 775
bak1
rsync -ar --delete /home/e-smith/files/ibays 192.168.1.100::backup
bak2
rsync -ar --delete /home/e-smith/files/ibays 192.168.1.101::backup
Thing is it does NOT work
I can run bak1 & bak2 manually and they execute
What am I doing wrong?
-
hi
did you restart cron service?
if yes, have you read log files in /var/log? (/var/log/messages and /var/log/cron)
you'd find the reason why your scripts don't work
HTH
Ciao
Stefano
-
To RESET cron I've setup a script
crontab -u root /etc/cron.d
/etc/init.d/crond restart
/var/log/con says cron started
/var/log/messages says cron startup succeded
-
bak1
rsync -ar --delete /home/e-smith/files/ibays 192.168.1.100::backup
bak2
rsync -ar --delete /home/e-smith/files/ibays 192.168.1.101::backup
Thing is it does NOT work
I can run bak1 & bak2 manually and they execute
What am I doing wrong?
One thing you are doing wrong is assuming that the execution environment will be the same when cron runs a command as when you do from the command line.
What happens if you do:
env - /sbin/bak1
from the command line?
-
it just runs the bak1 script
I don't see any difference from typing
env - /sbin/bak1 or just bak1 at the prompt!
Nothing shown on screen and nothing in /var/log/messages
I don't understand - if the script executes crom command line why not from cron?
I've done this before but the server is 7.2 and hasn't been updated since installed last october.
It Rsync just fine to a remote site
I've also tried another script that has
ls -l /home/e-smith > home/dir.txt
I've put this in the corn.hourly
This too does NOT seem to execute although I seen an entry ine /var/log/cron - run parts hourly
-
The cron environment normally is not aware of the paths to files unless you either code a PATH variable in your script or hardcode the path to all files you call in your script.