May 4, 201313 yr Hi all, I am trying to run rsync via a cron job from a local unRAID to a remote unRAID. I can't for the life of me figure out where to place the rsync line to keep it persistent after reboot. I did find a great rsync script in the forums but once again I'm not sure where to place the script. I want this to run as a cron job so I don't have to worry unless there is an error. I am very new to the Linux world so a great step by step how to would be great. Thanks in advance Edawg Sent from my SCH-R530U using Tapatalk 2
May 4, 201313 yr It sounds like you know what command(s) you want to run, just not how to keep the commands persistent? If you just need to add one or 2 commands to cron on reboot, add the lines to your "/boot/config/go" file. Something like: echo "0 */6 * * * rsync -avz /local/directory/location/ username@remoteHostName:/remote/directory/location/" >> /var/spool/cron/crontabs/root If you have several lines to add to cron, create a file on your flash drive ("/boot/custom/mycron" for example), place the multiple commands in the "/boot/custom/mycron file" then add this line to "/boot/config/go": cat /boot/custom/mycron >> /var/spool/cron/crontabs/root If you need help with the specific commands, http://www.thegeekstuff.com/2010/09/rsync-command-examples/ has some good info on rsync. Or just update your post with your questions.
May 4, 201313 yr Author Lainie thank you so much for the quick reply and the great examples. I'm foing to try this out right now. I'll post back my results. Thanks again Edawg Sent from my SCH-R530U using Tapatalk 2
May 4, 201313 yr Author Lainie I put everything together but for the "mycron" file what file format should i save it as? Also when does this "0 */6 * * *" execute? Thanks Edawg
May 4, 201313 yr Lainie I put everything together but for the "mycron" file what file format should i save it as? It is just a text file. If editing a text file in Windows, Notepad++ will allow you to save it in a Unix/Linux friendly format. When editing text files in Linux, I use vi (vi is installed on most Unix/Linux systems, but has a steep learning curve). If you want to add text to a new file via command line Linux, http://www.centos.org/docs/2/rhl-gsg-en-7.2/s1-navigating-usingcat.html shows an quick way. First: cat > /boot/custom/mycron Next, enter any text you want in the file. When you are done, hold down the Ctrl key and the D key to go back to the command prompt. You can then check that the text is the way you want it by typing cat /boot/custom/mycron Also when does this "0 */6 * * *" execute? Every 6 hours. http://www.thegeekstuff.com/2011/07/cron-every-5-minutes/ gives several examples of how to setup cron to run at any time you need. If you would like a list of the available rsync options: http://www.evbackup.com/support-commonly-used-rsync-arguments/ should help. In my example, I used "-avz" for archive, verbose, compressed (zipped). Those are common, but wanted you to be aware of the options in case the ones I listed do not fit your exact needs.
Archived
This topic is now archived and is closed to further replies.