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 () { 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
printf "${err}Error 100: Could not start '%s'${norm}\n" \ exitError 100 "Could not start ${seafService}"
"${seafService}" >> "$logFile"
exit 100
fi fi
if ! systemctl start "${seafHub}" >> "$logFile" 2>&1; then if ! systemctl start "${seafHub}" >> "$logFile" 2>&1; then
printf "${err}Error 101: Could not start '%s'${norm}\n" \ exitError 101 "Could not start ${seafHub}"
"${seafHub}" >> "$logFile"
exit 101
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
printf "${err}Error 103: Could not stop '%s'${norm}\n" \ exitError 103 "Could not stop ${seafHub}"
"${seafHub}" >> "$logFile"
exit 103
fi fi
if ! systemctl stop "${seafService}" >> "$logFile" 2>&1; then if ! systemctl stop "${seafService}" >> "$logFile" 2>&1; then
printf "${err}Error 102: Could not stop '%s'${norm}\n" \ exitError 102 "Could not stop ${seafService}"
"${seafService}" >> "$logFile"
exit 102
fi fi
fi fi
} }