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

View File

@ -80,16 +80,28 @@ seafSvc () {
if [ "$1" = "start" ]; then if [ "$1" = "start" ]; then
if ! systemctl start "${seafService}" >> "$logFile" 2>&1; then if ! systemctl start "${seafService}" >> "$logFile" 2>&1; then
exitError 100 "Could not start ${seafService}" exitError 100 "Could not start ${seafService}"
else
printf "${cyan}[%s] -- [INFO] Started service: %s --${norm}\n" \
"$(stamp)" "$seafService" >> "$logFile"
fi fi
if ! systemctl start "${seafHub}" >> "$logFile" 2>&1; then if ! systemctl start "${seafHub}" >> "$logFile" 2>&1; then
exitError 101 "Could not start ${seafHub}" exitError 101 "Could not start ${seafHub}"
else
printf "${cyan}[%s] -- [INFO] Started service: %s --${norm}\n" \
"$(stamp)" "$seafHub" >> "$logFile"
fi fi
elif [ "$1" = "stop" ]; then elif [ "$1" = "stop" ]; then
if ! systemctl stop "${seafHub}" >> "$logFile" 2>&1; then if ! systemctl stop "${seafHub}" >> "$logFile" 2>&1; then
exitError 103 "Could not stop ${seafHub}" exitError 103 "Could not stop ${seafHub}"
else
printf "${cyan}[%s] -- [INFO] Stopped service: %s --${norm}\n" \
"$(stamp)" "$seafService" >> "$logFile"
fi fi
if ! systemctl stop "${seafService}" >> "$logFile" 2>&1; then if ! systemctl stop "${seafService}" >> "$logFile" 2>&1; then
exitError 102 "Could not stop ${seafService}" exitError 102 "Could not stop ${seafService}"
else
printf "${cyan}[%s] -- [INFO] Stopped service: %s --${norm}\n" \
"$(stamp)" "$seafHub" >> "$logFile"
fi fi
fi fi
} }
@ -334,8 +346,6 @@ if [ "$offlineBackup" -eq 1 ]; then
printf "${cyan}[%s] -- [INFO] Stopping seafile services --${norm}\n" \ printf "${cyan}[%s] -- [INFO] Stopping seafile services --${norm}\n" \
"$(stamp)" >> "$logFile" "$(stamp)" >> "$logFile"
seafSvc stop seafSvc stop
printf "${ok}[%s] -- [SUCCESS] Seafile services STOPPED --${norm}\n" \
"$(stamp)" >> "$logFile"
fi fi