moved all service logging to func seafSvc

This commit is contained in:
Asif Bacchus 2019-05-25 13:23:29 -06:00
parent a3aea2179e
commit 15e79c8bf5
1 changed files with 12 additions and 2 deletions

View File

@ -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