LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Cron conundrum (http://www.linuxquestions.org/questions/linux-general-1/cron-conundrum-487696/)

crashsystems 09-28-2006 10:29 AM

Cron conundrum
 
I'm currently trying to make a cron script to do an hourly backup of the files on my Ubuntu 6.06 file server using rsync. I've included below the code for /etc/cron.hourly/rsync
Code:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

rsync -ae ssh --delete-after backup@192.168.0.100:/mnt/drive1/Shared /mnt/backup > /home/admin/rsync.hourly.log

Also, thinking that the problem could be with file ownership stuff, I double checked that out, and it has an owner and group of root, and the permissions are -rwxrwxr-x. When I run the command manually in bash, it works just fine. So I went into /var/log/syslog, and found the following:
Quote:

Sep 28 08:17:01 localhost /USR/SBIN/CRON[31613]: (root) CMD ( run-parts --report /etc/cron.hourly)
Sep 28 08:17:01 localhost /USR/SBIN/CRON[31612]: (root) MAIL (mailed 152 bytes of output but got status 0x0001 )
My rsync script is the only script in /etc/cron.hourly, so I'm assuming that this entry from syslog is referring to my script. If anyone has an idea of why my cron script is not working, your help would be appreciated.


crashsystems

P.S.
I have configured passwordless logins for ssh, so that can't be the problem.

konsolebox 09-29-2006 03:11 AM

try to append '2>/dev/null' to your rsync command.

crashsystems 09-29-2006 09:53 AM

Well, I figured it out, though I'm not quite sure how. I decided to go look at some of the pre-configured cron.daily scripts to see if I could learn some from them. I decided to mimic their exact permissions for owner group and other. Once I did that, it worked perfectly, which is strange due to the fact that I had already made the script executable.

crashsystems


All times are GMT -5. The time now is 06:29 AM.