Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/bash
- logfile=/var/log/rsnapshot/rsnap_backups.log
- #remove old logs before starting
- #rm $logfile
- #replaced with > on outputs for testing
- #begin
- echo "Starting Daily Backup Schedule" > $logfile
- echo "Running primary rsnapshot job" >> $logfile
- rsnapshot daily &
- sleep 5
- #Sets PIDFILE of rsnapshot:
- PIDFILE=/var/run/rsnapshot.pid
- #While PID exists, wait for it not to.
- while [ -f $PIDFILE ]
- do
- echo "Waiting...rsnapshot is currently running" >> $logfile
- sleep 15m
- done
- #Output end of rsnapshot logs to this scripts log for reference
- tail /var/log/rsnapshot/rsnapshot.log >> $logfile
- job=bahamut
- echo "Running $job backup" >> $logfile
- rsnapshot -c /etc/rsnapshot.d/$job.conf daily
- echo "Completed $job successfully" >> $logfile
- #Output end of rsnapshot logs to this scripts log for reference
- tail /var/log/rsnapshot/$job.log >> $logfile
- #While PID exists, wait for it not to.
- while [ -f $PIDFILE ]
- do
- echo "Waiting...rsnapshot is currently running" >> $logfile
- sleep 15m
- done
- job=vipremobile
- echo "Running $job backup" >> $logfile
- rsnapshot -c /etc/rsnapshot.d/$job.conf daily
- echo "Completed $job successfully" >> $logfile
- #Output end of rsnapshot logs to this scripts log for reference
- tail /var/log/rsnapshot/$job.log >> $logfile
- #While PID exists, wait for it not to.
- while [ -f $PIDFILE ]
- do
- echo "Waiting...rsnapshot is currently running" >> $logfile
- sleep 15m
- done
- job=vipremobile-api
- echo "Running $job backup" >> $logfile
- rsnapshot -c /etc/rsnapshot.d/$job.conf daily
- echo "Completed $job successfully" >> $logfile
- #Output end of rsnapshot logs to this scripts log for reference
- tail /var/log/rsnapshot/$job.log >> $logfile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement