From 9ec2a1ca170373169ba610b68e08150cc57c7d37 Mon Sep 17 00:00:00 2001 From: Glyn Hudson Date: Fri, 22 Jun 2018 00:38:28 +0000 Subject: [PATCH] more detail log and restart feedwritier if errored exit Conflicts: emoncms-export.sh --- emoncms-export.sh | 7 +++++-- emoncms-import.sh | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/emoncms-export.sh b/emoncms-export.sh index 513620e..a363e78 100755 --- a/emoncms-export.sh +++ b/emoncms-export.sh @@ -17,6 +17,7 @@ then else echo "ERROR: Backup /home/pi/backup/config.cfg file does not exist" exit 1 + sudo service feedwriter start > /dev/null fi #----------------------------------------------------------------------------------------------- @@ -67,6 +68,7 @@ if [ -f /home/pi/backup/get_emoncms_mysql_auth.php ]; then else echo "Error: cannot read MYSQL authentication details from Emoncms settings.php" echo "$PWD" + sudo service feedwriter start > /dev/null exit 1 fi @@ -81,10 +83,11 @@ if [ -n "$username" ]; then # if username string is not empty else echo "Error: Cannot read MYSQL authentication details from Emoncms settings.php" + sudo service feedwriter start > /dev/null exit 1 fi -echo "Emoncms MYSQL database dump complete, adding files to archive .." +echo "Emoncms MYSQL database dump complete, adding files to archive..." if [ $image="old" ]; then # Create backup archive and add config files stripping out the path @@ -118,7 +121,7 @@ fi # Compress backup echo "Compressing archive..." -gzip -f $backup_location/emoncms-backup-$date.tar 2>&1 +gzip -fv $backup_location/emoncms-backup-$date.tar 2>&1 if [ $? -ne 0 ]; then echo "Error: failed to compress tar file" echo "emoncms export failed" diff --git a/emoncms-import.sh b/emoncms-import.sh index 819beca..61c9a5d 100755 --- a/emoncms-import.sh +++ b/emoncms-import.sh @@ -80,7 +80,7 @@ if [ ! -d $backup_location/import ]; then sudo chown pi $backup_location/import -R fi -tar xfz $backup_source_path/$backup_filename -C $backup_location/import 2>&1 +tar xfzv $backup_source_path/$backup_filename -C $backup_location/import 2>&1 if [ $? -ne 0 ]; then echo "Error: failed to decompress backup" echo "$backup_source_path/$backup_filename has not been removed for diagnotics"