Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #!/bin/bash
  2. # Autobackup and deleting Oldest Files
  3. # Backup for Nitrado Server, Saving Games
  4. # Script handles the FTP Login over wget Command
  5. # Authors: Daniel Agocs
  6. # Date: 25.04.2018
  7.  
  8. export DISPLAY=:0
  9. lxterminal -e screen /usr/develop/nitrado/nitrado_backup.sh &
  10. PROC=$!
  11.  
  12.  
  13. # Variables
  14. USER="xxx"
  15. PASSWORD="xxx"
  16. SERVER="ftp://ms1312.nitrado.net/7daystodie/Saves/"
  17. OUTPUT_DIR="/home/pi/Documents/BACKUPS/nitrado/"
  18. LOG="/var/log/nitrado_backup.log"
  19. TIMESTAMP=`date "+%d-%m-%Y/%H:%M:%S"`
  20. SLEEP=1
  21.  
  22. function echo_log {
  23. echo $TIMESTAMP" $1" >> $LOG
  24. }
  25.  
  26. echo -e "$TIMESTAMP \nWait $SLEEP sec to continue"
  27. /bin/sleep $SLEEP
  28.  
  29. sudo wget -r -N --ftp-user=$USER --ftp-password=$PASSWORD $SERVER -P $OUTPUT_DIR
  30.  
  31. echo -e " ! ! ! DATEN GEHOLT ! ! ! EXITCODE: $? "
  32. /bin/sleep $SLEEP
  33.  
  34.  
  35. if [ $? -ne 0 ]; then
  36. echo -e "Backup von $SERVER gescheitert! EXITCODE: $? Infos in der Log-Datei ---> $LOGFILE"
  37. echo_log "Backup not Created, CODE: $?"
  38. else
  39. echo -e "Backup von $SERVER war erfolgreich! Letztes Backup $TIMESTAMP"
  40. echo_log "Backup Created everythink fine, CODE: $?"
  41. fi
  42.  
  43. echo $PROC
  44. kill $PROC
  45. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement