diff --git a/backup_new.sh b/backup_new.sh index 0c11363..0bb2907 100755 --- a/backup_new.sh +++ b/backup_new.sh @@ -45,25 +45,17 @@ exitError () { seafSvc () { if [ "$1" = "start" ]; then if ! systemctl start "${seafService}" >> "$logFile" 2>&1; then - printf "${err}Error 100: Could not start '%s'${norm}\n" \ - "${seafService}" >> "$logFile" - exit 100 + exitError 100 "Could not start ${seafService}" fi if ! systemctl start "${seafHub}" >> "$logFile" 2>&1; then - printf "${err}Error 101: Could not start '%s'${norm}\n" \ - "${seafHub}" >> "$logFile" - exit 101 + exitError 101 "Could not start ${seafHub}" fi elif [ "$1" = "stop" ]; then if ! systemctl stop "${seafHub}" >> "$logFile" 2>&1; then - printf "${err}Error 103: Could not stop '%s'${norm}\n" \ - "${seafHub}" >> "$logFile" - exit 103 + exitError 103 "Could not stop ${seafHub}" fi if ! systemctl stop "${seafService}" >> "$logFile" 2>&1; then - printf "${err}Error 102: Could not stop '%s'${norm}\n" \ - "${seafService}" >> "$logFile" - exit 102 + exitError 102 "Could not stop ${seafService}" fi fi }