On Sat, 06 Oct 2018 13:08:21 -0700 Tomas K <[email protected]> dijo:
>Simple if statement in your backup script should take care of it. >You can do it number of ways - here is one - checking that there is any >content in the directory before starting rsync (in bash): > >#!/bin/bash >backupTargetDir=/media/jjj/Synology >cd $backupTargetDir ># wait 30 seconds for the directory to mount >sleep 30 >filesInDir=$(ls | wc -l) >if (( $filesInDir > 0 )); then > echo "INFO: Backing up files to $backupTargetDir" > rsync .... >else > echo "WARNING: No files in $backupTargetDir" >fi ¡Me gusta! Here is how I finalized it: #!/bin/bash cd .. cd /media/jjj/Movies backupTargetDir=/media/jjj/Synology cd $backupTargetDir # wait 30 seconds for the directory to mount sleep 30 filesInDir=$(ls | wc -l) if (( $filesInDir > 0 )); then echo "INFO: Backing up files to $backupTargetDir" rsync -rptog --progress --stats --delete --exclude-from=/media/jjj/Movies/rsync_exclusions /media/jjj/Movies/ /media/jjj/Synology else echo "WARNING: No files in $backupTargetDir" fi I could probably add another if statement to be sure that /media/JJJ/Movies is mounted, but that's my work directory, so it's highly unlikely that it would not be mounted. I tested it and it works fine! Thanks for the help! _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
