From 15e79c8bf528396cb4cda9323e4bd35189c3603a Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sat, 25 May 2019 13:23:29 -0600 Subject: [PATCH] moved all service logging to func seafSvc --- backup_new.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/backup_new.sh b/backup_new.sh index b4c487c..954a944 100755 --- a/backup_new.sh +++ b/backup_new.sh @@ -80,16 +80,28 @@ seafSvc () { if [ "$1" = "start" ]; then if ! systemctl start "${seafService}" >> "$logFile" 2>&1; then exitError 100 "Could not start ${seafService}" + else + printf "${cyan}[%s] -- [INFO] Started service: %s --${norm}\n" \ + "$(stamp)" "$seafService" >> "$logFile" fi if ! systemctl start "${seafHub}" >> "$logFile" 2>&1; then exitError 101 "Could not start ${seafHub}" + else + printf "${cyan}[%s] -- [INFO] Started service: %s --${norm}\n" \ + "$(stamp)" "$seafHub" >> "$logFile" fi elif [ "$1" = "stop" ]; then if ! systemctl stop "${seafHub}" >> "$logFile" 2>&1; then exitError 103 "Could not stop ${seafHub}" + else + printf "${cyan}[%s] -- [INFO] Stopped service: %s --${norm}\n" \ + "$(stamp)" "$seafService" >> "$logFile" fi if ! systemctl stop "${seafService}" >> "$logFile" 2>&1; then exitError 102 "Could not stop ${seafService}" + else + printf "${cyan}[%s] -- [INFO] Stopped service: %s --${norm}\n" \ + "$(stamp)" "$seafHub" >> "$logFile" fi fi } @@ -334,8 +346,6 @@ if [ "$offlineBackup" -eq 1 ]; then printf "${cyan}[%s] -- [INFO] Stopping seafile services --${norm}\n" \ "$(stamp)" >> "$logFile" seafSvc stop - printf "${ok}[%s] -- [SUCCESS] Seafile services STOPPED --${norm}\n" \ - "$(stamp)" >> "$logFile" fi