Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Autobackup and Deleting Oldest Files
- # Backup for Nitrado Server, Saving Games Saves
- # Script handles the FTP Login over wget Command
- # Authors: Daniel Agocs
- # Date: 25.04.2018
- export DISPLAY=:0
- lxterminal -e screen /dev/ttyS0
- #PROC=$!
- # Variables
- USER="xxx"
- PASSWORD="xxx"
- SERVER="ftp://ms1312.nitrado.net/7daystodie/Saves/"
- OUTPUT_DIR="/home/pi/Documents/BACKUPS/nitrado/"
- LOG="/var/log/Nitrado-Backup.log"
- TIMESTAMP=`date "+%d-%m-%Y/%H:%M:%S"`
- SLEEP=1
- function echo_log {
- echo $TIMESTAMP" $1" >> $LOG
- }
- echo -e "$TIMESTAMP \nWait $SLEEP sec to continue"
- /bin/sleep $SLEEP
- sudo wget -r -N --ftp-user=$USER --ftp-password=$PASSWORD $SERVER -P $OUTPUT_DIR
- echo -e " ! ! ! DATEN GEHOLT ! ! ! EXITCODE: $? "
- /bin/sleep $SLEEP
- if [ $? -ne 0 ]; then
- echo -e "Backup von $SERVER gescheitert! EXITCODE: $? Infos in der Log-Datei ---> $LOGFILE"
- echo_log "Backup not Created, CODE: $?"
- else
- echo -e "Backup von $SERVER war erfolgreich! Letztes Backup $TIMESTAMP"
- echo_log "Backup Created everythink fine, CODE: $?"
- fi
- #kill $PROC
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement