- if ! isIncompleteOrNthDay; then
- scottyinfo "This is not the nth day and no incomplete backup exists."
- exit 0
+ while getopts "qn:flh" opt; do
+ case $opt in
+ q)
+ exec > /dev/null
+ ;;
+ n)
+ BACKUP_RUNEVERYNTHDAY=$OPTARG
+ ;;
+ f)
+ BACKUP_FORCE=1
+ ;;
+ l)
+ LIST_BACKUPS=1
+ ;;
+ h)
+ printhelp
+ exit 0
+ ;;
+ esac
+ done
+
+ ssh255 $REMOTE_HOST exit
+
+ if [ $LIST_BACKUPS ]; then
+ for backup in $(grepbackups); do
+ echo $backup
+ done
+ exit 0
+ fi
+
+ exclusiveLock
+
+ if [ $BACKUP_FORCE -eq 1 ]; then
+ scottyinfo "Backup was enforced."
+ elif latestTooOld; then
+ scottyerror "The latest backup is too old."
+ elif isNthDay; then
+ scottyinfo "This is the nth day."
+ else
+ scottyinfo "No backup has to be done. Exiting."
+ exit 0