Last active
March 30, 2016 14:22
-
-
Save erangaeb/254a8dcbfcbc53f11fde to your computer and use it in GitHub Desktop.
Rsync with cron job
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # edit crontab file | |
| crontab -e | |
| # rsync as a cron job | |
| 30 23 * * * flock -n /tmp/rsync.lock -c "rsync -avzh [email protected]:/home/pagero/storage/ /home/eranga/storage/>/tmp/rsync.log" | |
| # things to notice | |
| 1. 30 23 : Cron job runs everyday 23:30 PM (11.30 PM) | |
| 2. flock -n /tmp/rsync.lock : Will prevents to run duplicate cronjobs(means only one cron job will be running) | |
| 3. >/tmp/rsync.log : Will take the output of rsync job to /tmp/rsyn.log file | |
| # list cron jobs | |
| crontab -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment