Advertisement
ThiemoK

Untitled

Oct 10th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.20 KB | None | 0 0
  1. #!/bin/sh
  2. ###
  3. # 30/07/13
  4. # systembackup.sh
  5. # Backup Script für den Systemdatenträger
  6. #
  7. # Erstellt ein Image des Systemdatenträgers und sendet nach Abschluss des Vorganges eine Benachrichtigung über den Status
  8. ###
  9.  
  10. #cron stoppen
  11. /etc/init.d/cron stop
  12.  
  13. #Image erstellen
  14. START=$(date +%s)
  15. rsync -aAXv --exclude=storagepool/* --exclude=dev/* --exclude=proc/* --exclude=sys/* --exclude=tmp/* --exclude=run/* --exclude=mnt/* --exclude=media/* --exclude=lost+found --delete /* /storagepool/TimeMachine/Fileserver_Systembackup
  16.  
  17. #Benachrichtigung über ergebnis versenden
  18.  
  19. if [ $? -eq 0 ];
  20.     then
  21.                 FINISH=$(date +%s)
  22.                 APIKEY=
  23.         curl https://api.prowlapp.com/publicapi/add \
  24.             -F apikey=$APIKEY \
  25.             -F application=Fileserver \
  26.             -F event="System Backup" \
  27.             -F description="Backup erfolgreich abgeschlossen in $(( ($FINISH-$START) / 60 )) minutes, $(( ($FINISH-$START) % 60 )) seconds"
  28.     else
  29.                 APIKEY=
  30.         curl https://api.prowlapp.com/publicapi/add \
  31.             -F apikey=$APIKEY \
  32.             -F priority=2 \
  33.             -F application=Fileserver \
  34.             -F event="System Backup" \
  35.             -F description="Backup fehlgeschlagen"
  36. fi
  37.  
  38. #cron wieder starten
  39. /etc/init.d/cron start
  40.  
  41. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement