Find the answer to your Linux question:
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 ...
  1. #1
    Just 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

  2. #2
    Linux 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

  3. #3
    Linux 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.

  4. #4
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    Code:
    * 4 * * 2 root /rsync -ravz snoopy2:/share /root/backup
    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/

  5. #5
    Linux User Krendoshazin's Avatar
    Join Date
    Feb 2005
    Location
    London, England
    Posts
    385
    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:
    Code:
    * 4 * * 2 root /etc/rsyncscript
    Addendum:

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...