Results 1 to 5 of 5
I am brand new to this, so bear with me.
we got a script that backs up one computer to another through rsync. Now I am trying to have our ...
- 05-15-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 5
crontab not working
I am brand new to this, so bear with me.
we got a script that backs up one computer to another through rsync. Now I am trying to have our computer run that script on a weekly basis. Snoopy2 is the server and Homer is the computer that is saving the backup onto
It is called "rsyncscript" and it works when entered into a terminal line
/rsync -ravz snoopy2:/share /root/backup
I logged in as root on the machine that we are trying to backup the new data to (Homer)
I nano crontab and added the last line:
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
* 4 * * 2 root run-parts /etc/rsyncscript
I also tried the last line as:
* 4 * * 2 root /rsync -ravz snoopy2:/share /root/backup
I basically want that above script to run any day of the week at night when we are not in the lab, and automatically do it every week. Open to any ideas and any help however links to linux pages are not that helpful because they are often too advanced. I make dumb mistakes that I do not realize because I first used linux a few months ago (like I learned cd means change directory then)
Neither of the above worked when I thought they were supposed to. I do not know how to edit crontab and need very step by step instructions. Any help is greatly appreciated.
Nick
- 05-16-2009 #2Linux User
- Join Date
- May 2009
- Location
- Big River, Sask, Canada
- Posts
- 342
It looks to me like you are trying to run the script on the wrong machine.
Snoopy should have the scripts, and Homer just needs the directories for snoopy to back up to.Registered Linux User #420832
- 05-16-2009 #3Linux Guru
- Join Date
- Oct 2007
- Location
- Tucson AZ
- Posts
- 1,939
Agree with Hal343 and assume you got this working now. As far as step by step guides, if you google cron tutorials you will find a large number of very good tutorials, Read a few to get familiar. I think that would work better for you.
- 05-16-2009 #4Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
Do you have rsync installed to the root partition? You are giving the full path to rsync as being in /. Usually rsync is installed to /usr/bin/Code:* 4 * * 2 root /rsync -ravz snoopy2:/share /root/backup
- 05-23-2009 #5
The problem to me appears to be that you are using run-parts incorrectly. run-parts is designed to go through a directory and execute all of the scripts it finds, however you have provided what appears to be a script as the directory for it to search. Assuming that rsyncscript is executable then this would be the cronjob:
Addendum:Code:* 4 * * 2 root /etc/rsyncscript
By they way, why don't you put rsyncscript in /etc/cron.weekly and get rid of the cronjob, that's what they're there for. I don't see any reason for it to stay in /etc. Unless you absolutely need a specific day or a specific time then there is no reason to create a cronjob for it.


Reply With Quote