Hi,
hab ein automatisches Backup Script in einem anderen Forum gefunden.
Hab das mal vor Monaten genutzt, da hat es ohne Probleme direkt funktioniert,
Jetzt kommen Fehlermeldungen.
Hier das Script:
Shell-Script
- #!/bin/bash
- PROJNAME=metin2
- CHARSET=utf8
- DBNAME01=account
- DBNAME02=common
- DBNAME03=player
- DBFILENAME01=account
- DBFILENAME02=common
- DBFILENAME03=player
- HOST=localhost
- USER=db_user
- PASSWD="geheimespasswort"
- DATADIR=/backup/metin2
- SRCFILES=/usr/home/game
- PREFIX=`date +%F`
- echo $PASSWD
- #start backup
- echo "[--------------------------------[`date +%F--%H-%M`]--------------------------------]"
- echo "[--START!--][`date +%F--%H-%M`] Run the backup script..."
- mkdir $DATADIR/$PREFIX 2> /dev/null
- echo "[+---------][`date +%F--%H-%M`] Generate a database backup..."
- #MySQL dump
- mysqldump --user=$USER --host=$HOST --password="$PASSWD" --default-character-set=$CHARSET $DBNAME01 > $DATADIR/$PREFIX/$DBFILENAME01-`date +%F-%H-%M`.sql
- mysqldump --user=$USER --host=$HOST --password="$PASSWD" --default-character-set=$CHARSET $DBNAME02 > $DATADIR/$PREFIX/$DBFILENAME02-`date +%F-%H-%M`.sql
- mysqldump --user=$USER --host=$HOST --password="$PASSWD" --default-character-set=$CHARSET $DBNAME03 > $DATADIR/$PREFIX/$DBFILENAME03-`date +%F-%H-%M`.sql
- if [[ $? -gt 0 ]];then
- echo "[----------][`date +%F--%H-%M`] Aborted. Generate database backup failed."
- exit 1
- fi
- echo "[++--------][`date +%F--%H-%M`] Backup database - successfull."
- #Src dump
- echo "[+++-------][`date +%F--%H-%M`] Copy the source code project [$PROJNAME]..."
- tar -czpf $DATADIR/$PREFIX/$PROJNAME-`date +%F-%H-%M`.tar.gz $SRCFILES 2> /dev/null
- if [[ $? -gt 0 ]];then
- echo "[----------][`date +%F--%H-%M`] Aborted. Copying the source code failed."
- exit 1
- fi
- echo "[++++------][`date +%F--%H-%M`] Copy the source code project successfull."
- echo "[+++++-----][`date +%F--%H-%M`] Prepare zip file $PROJNAME-$PREFIX.zip..."
- zip -r $DATADIR/$PROJNAME-$PREFIX.zip $DATADIR/$PREFIX
- if [[ $? -gt 0 ]];then
- echo "[----------][`date +%F--%H-%M`] Aborted. Make zip file failed."
- exit 1
- fi
- echo "[++++++----][`date +%F--%H-%M`] Zip file $PROJNAME-$PREFIX.zip finished."
- echo "[+++++++---][`date +%F--%H-%M`] Remove folder."
- rm -rf $DATADIR/$PREFIX
- if [[ $? -gt 0 ]];then
- echo "[----------][`date +%F--%H-%M`] Remove folder failed."
- exit
- fi
- echo "[++++++++--][`date +%F--%H-%M`] Remove folder finished."
- echo "[+++++++++-][`date +%F--%H-%M`] Start datadir space (USED): `du -h $DATADIR | tail -n1`"
- echo "[++++++++++][`date +%F--%H-%M`] Free HDD space: `df -h /home|tail -n1|awk '{print $4}'`"
- echo "[+SUCCESS!+][`date +%F--%H-%M`] All operations completed successfully!"
- exit 0
Die Meldungen die kommen:
Shell-Script
- [--------------------------------[2022-09-24--19-17]--------------------------------]
- [--START!--][2022-09-24--19-17] Run the backup script...
- : Operation not supported/dev/null
- [+---------][2022-09-24--19-17] Generate a database backup...
- : No such file or directoryackup/metin2
- : No such file or directoryackup/metin2
- : No such file or directoryackup/metin2
- backup.sh: 58: Syntax error: end of file unexpected (expecting "then")
Jemand eine Idee?