Advertisement
Guest User

Untitled

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