Rsync with cron that will only run if another rsync isn't already running..

  • Donator

    Hi to All,

    I want to create crontab in order to run a script that backs up my local files to my remote server. The problem is that if there are too many files to transfer (Example: I ripped a DVD in the last hour) the actual backup may take longer than 60 minutes. So I want to make script to check if my backup script, based on rsync, is running. If rsync is still running then do nothing and exit the script. If it is not running, execute the script as normal.If the specific rsync finished with success , then send an email.

    Any help is much appreciated. Many thanks..

  • administrators

    I would go with rsync daemon and inotifywait both in daemon mode or executed via rc.local.
    The source machine would run rsync with necessary flags, watch for new files & transfer files from path/s, on other end intoifywait utility would watch for close_write and you can easily script email functionality on close_write so that you know when the transfer completed.

Log in to reply