I have an rsync command which does replication of sorts:
0 0 * * * rsync -av --delete /media/VIDEOS/ /media/lacie1/backup/videos/
Is there a way to stop the rsync command from running if the source is not accessible (ie: not online/mounted)?
|
|
You could try
which will not run the rsync command if the cd fails which it should if the source doesn't exist. If you want it to fail silently
|
|||||||||||
|
|
Souds like you're doing a midnight backup of your desktop computer and you're being spammed by the cron daemon about the failing backup. The simple and crude solution would be to silence the cron, which can be done in two ways: 0 0 * * * rsync .. > /dev/null 2>&1 This will redirect stdout and stderr to /dev/null.. no mail from cron Another solution is to define an empty email with MAILTO MAILTO=root 0 0 * * * script1 MAILTO= 0 0 * * * rsync .. This should silence the script, too. |
|||
|
|