func seafSvc: proper logging

This commit is contained in:
Asif Bacchus 2019-05-23 21:54:19 -06:00
parent b91fd028b8
commit b94fef7db2

View File

@ -38,21 +38,25 @@ badParam () {
# control seafile services (systemd)
seafSvc () {
if [ "$1" = "start" ]; then
if ! systemctl start "${seafSvc}" >> "$logFile" 2>&1; then
echo "error starting seafile service"
if ! systemctl start "${seafService}" >> "$logFile" 2>&1; then
printf "${err}Error 100: Could not start '%s'${norm}\n" \
"${seafService}" >> "$logFile"
exit 100
fi
if ! systemctl start "${seafHub}" >> "$logFile" 2>&1; then
echo "error starting seahub service"
printf "${err}Error 101: Could not start '%s'${norm}\n" \
"${seafHub}" >> "$logFile"
exit 101
fi
elif [ "$1" = "stop" ]; then
if ! systemctl stop "${seafHub}" >> "$logFile" 2>&1; then
echo "error stopping seahub service"
printf "${err}Error 103: Could not stop '%s'${norm}\n" \
"${seafHub}" >> "$logFile"
exit 103
fi
if ! systemctl stop "${seafSvc}" >> "$logFile" 2>&1; then
echo "error stopping seafile service"
if ! systemctl stop "${seafService}" >> "$logFile" 2>&1; then
printf "${err}Error 102: Could not stop '%s'${norm}\n" \
"${seafService}" >> "$logFile"
exit 102
fi
fi