3 Commits

2 changed files with 44 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ DESC = This package supplies the core required init scripts for startup
ARCHIVE := ''
SRCDIR := $(PWD)/SRC/initscripts
PATCHDIR := $(PWD)/SRC/patches
VERSION := 1.9-1
VERSION := 1.12-0
include /usr/share/snap/Makefile.snaplinux

View File

@@ -187,15 +187,52 @@ status_of_proc() {
esac
done
# Here we use LSB as a reference for the return values:
#
# 0 program is running or service is OK
# 1 program is dead and /var/run pid file exists
# 2 program is dead and /var/lock lock file exists
# 3 program is not running
# 4 program or service status is unknown
# 5-99 reserved for future LSB use
# 100-149 reserved for distribution use
# 150-199 reserved for application use
# 200-254 reserved
#
# As you can see however, for now we just support 0, 1, 3 and 4
# May do something for 2 at some point, but the other status
# codes should not be used here - they're only here for reference
if [ -n "$pidfile" ]; then
pid=$(pidofproc -p "$pidfile" "$pathname");
if [ -r "$pidfile" ]; then
pid=$(pidofproc -p "$pidfile" "$pathname")
if [ "$?" -eq 0 ]; then
echo "$NAME running with PID: $pid" && return 0
else
echo "$NAME is not running" && return 1
fi
else
pid=$(pidofproc "$pathname")
if [ "$?" -eq 0 ]; then
echo "Cannot read pid file ($pidfile)"
echo "$NAME running with PID: $pid"
return 4
else
echo "$NAME is not running"
return 3
fi
fi
else
pid=$(pidofproc "$pathname")
fi
if [ "$?" -ne 0 ]; then
echo "$NAME is not runing" && return 1
else
echo "$NAME running with PID: $pid"
if [ "$?" -eq 0 ]; then
echo "$NAME running with PID: $pid"
return 0
else
echo "$NAME is not runing"
return 3
fi
fi
}