Here are some examples of how to use the conditional shell code field. Remember that for a backup to start both the source and destination conditional shell code must return true.
true; Disable the conditional shell code by entering true. Do not leave the field empty, but enter true if you have no conditions.
false; This disables backup. This could be applied to a backup of a source to all destinations or all backups directed to a specific destination.
test -d /Users/andrs/Documents/myfolder; This means only do the backup if /Users/andrs/Documents/myfolder
exists and is a folder.
traceroute -m 2 192.168.1.22; This means that backup will only execute if the ip-address 192.168.1.22 is minumum 2 hops away and the computer is on. If you backup from your laptop, this will tell the backupscript to only backup to the computer at your home LAN when you are home.
isrunning MacSoup.app; This means that rsyncbackup will only run if a process named MacSoup.app is currently running. isrunning
is a tool provided with rsyncbackup and has to be installed into path to work.
isnotrunning Safari.app; This means that rsyncbackup will only run if a process named Safari.app is currently not running. isnotrunning
is a tool provided with rsyncbackup and has to be installed into path to work.
PATH
When running rsyncbackup from cron, be sure that the conditional shell code commands are in you enviroment PATH. The PATH variable in a crontab is not neccessarily the same as in you login shell. To be sure things are correct, use full paths in the conditional shell code field.
If you enter a command which is not available from the PATH, the conditional shell code fails, and backup will not proceed. Neigher will this produce error output.
The true
and false
commands are most often avialable, but such as ping and traceroute might require an additional path.