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) # control seafile services (systemd)
seafSvc () { seafSvc () {
if [ "$1" = "start" ]; then if [ "$1" = "start" ]; then
if ! systemctl start "${seafSvc}" >> "$logFile" 2>&1; then if ! systemctl start "${seafService}" >> "$logFile" 2>&1; then
echo "error starting seafile service" printf "${err}Error 100: Could not start '%s'${norm}\n" \
"${seafService}" >> "$logFile"
exit 100 exit 100
fi fi
if ! systemctl start "${seafHub}" >> "$logFile" 2>&1; then 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 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
echo "error stopping seahub service" printf "${err}Error 103: Could not stop '%s'${norm}\n" \
"${seafHub}" >> "$logFile"
exit 103 exit 103
fi fi
if ! systemctl stop "${seafSvc}" >> "$logFile" 2>&1; then if ! systemctl stop "${seafService}" >> "$logFile" 2>&1; then
echo "error stopping seafile service" printf "${err}Error 102: Could not stop '%s'${norm}\n" \
"${seafService}" >> "$logFile"
exit 102 exit 102
fi fi
fi fi