Skip to content

Commit

Permalink
more detail log and restart feedwritier if errored exit
Browse files Browse the repository at this point in the history
Conflicts:
	emoncms-export.sh
  • Loading branch information
glynhudson committed Jun 22, 2018
1 parent b8e0876 commit 9ec2a1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions emoncms-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

#-----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion emoncms-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9ec2a1c

Please sign in to comment.