From ca0db04a3b694e7b409d3ae9a1813a0473b7c7c9 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Thu, 23 May 2019 23:19:53 -0600 Subject: [PATCH] func seafSvc: use func exitError --- backup_new.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) 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 }