diff --git a/backup_new.sh b/backup_new.sh index 7e7500b..2419bc4 100755 --- a/backup_new.sh +++ b/backup_new.sh @@ -38,21 +38,25 @@ badParam () { # control seafile services (systemd) seafSvc () { if [ "$1" = "start" ]; then - if ! systemctl start "${seafSvc}" >> "$logFile" 2>&1; then - echo "error starting seafile service" + if ! systemctl start "${seafService}" >> "$logFile" 2>&1; then + printf "${err}Error 100: Could not start '%s'${norm}\n" \ + "${seafService}" >> "$logFile" exit 100 fi if ! systemctl start "${seafHub}" >> "$logFile" 2>&1; then - echo "error starting seahub service" + printf "${err}Error 101: Could not start '%s'${norm}\n" \ + "${seafHub}" >> "$logFile" exit 101 fi elif [ "$1" = "stop" ]; then if ! systemctl stop "${seafHub}" >> "$logFile" 2>&1; then - echo "error stopping seahub service" + printf "${err}Error 103: Could not stop '%s'${norm}\n" \ + "${seafHub}" >> "$logFile" exit 103 fi - if ! systemctl stop "${seafSvc}" >> "$logFile" 2>&1; then - echo "error stopping seafile service" + if ! systemctl stop "${seafService}" >> "$logFile" 2>&1; then + printf "${err}Error 102: Could not stop '%s'${norm}\n" \ + "${seafService}" >> "$logFile" exit 102 fi fi