Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. #!/usr/bin/bash
  2. logfile=/var/log/rsnapshot/rsnap_backups.log
  3.  
  4. #remove old logs before starting
  5. #rm $logfile
  6. #replaced with > on outputs for testing
  7.  
  8. #begin
  9. echo "Starting Daily Backup Schedule" > $logfile
  10. echo "Running primary rsnapshot job" >> $logfile
  11. rsnapshot daily &
  12. sleep 5
  13.  
  14. #Sets PIDFILE of rsnapshot:
  15. PIDFILE=/var/run/rsnapshot.pid
  16.  
  17.  
  18. #While PID exists, wait for it not to.
  19. while [ -f $PIDFILE ]
  20. do
  21. echo "Waiting...rsnapshot is currently running" >> $logfile
  22. sleep 15m
  23. done
  24.  
  25. #Output end of rsnapshot logs to this scripts log for reference
  26. tail /var/log/rsnapshot/rsnapshot.log >> $logfile
  27.  
  28. job=bahamut
  29. echo "Running $job backup" >> $logfile
  30. rsnapshot -c /etc/rsnapshot.d/$job.conf daily
  31. echo "Completed $job successfully" >> $logfile
  32.  
  33. #Output end of rsnapshot logs to this scripts log for reference
  34. tail /var/log/rsnapshot/$job.log >> $logfile
  35.  
  36. #While PID exists, wait for it not to.
  37. while [ -f $PIDFILE ]
  38. do
  39. echo "Waiting...rsnapshot is currently running" >> $logfile
  40. sleep 15m
  41. done
  42.  
  43. job=vipremobile
  44. echo "Running $job backup" >> $logfile
  45. rsnapshot -c /etc/rsnapshot.d/$job.conf daily
  46. echo "Completed $job successfully" >> $logfile
  47.  
  48. #Output end of rsnapshot logs to this scripts log for reference
  49. tail /var/log/rsnapshot/$job.log >> $logfile
  50.  
  51. #While PID exists, wait for it not to.
  52. while [ -f $PIDFILE ]
  53. do
  54. echo "Waiting...rsnapshot is currently running" >> $logfile
  55. sleep 15m
  56. done
  57.  
  58. job=vipremobile-api
  59. echo "Running $job backup" >> $logfile
  60. rsnapshot -c /etc/rsnapshot.d/$job.conf daily
  61. echo "Completed $job successfully" >> $logfile
  62.  
  63. #Output end of rsnapshot logs to this scripts log for reference
  64. tail /var/log/rsnapshot/$job.log >> $logfile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement