func seafSvc: use func exitError

This commit is contained in:
Asif Bacchus 2019-05-23 23:19:53 -06:00
parent d41b0d13d3
commit ca0db04a3b
1 changed files with 4 additions and 12 deletions

View File

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