3 Commits

Author SHA1 Message Date
Jay Larson
795ed0feaa Updated init-functions to be more thorough in checking pids 2018-10-05 16:54:46 -05:00
Jay Larson
c6456ba7d3 Modified init-functions so that pidofproc properly returns non-zero 2018-09-30 19:07:50 -05:00
Jay Larson
a101cfe1c0 Added dependencies on grep and sed 2018-09-30 18:43:44 -05:00
2 changed files with 44 additions and 8 deletions

View File

@@ -8,7 +8,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
DEPENDS = dash,kmod,perl,procps-ng,sysvinit DEPENDS = dash,grep,kmod,perl,procps-ng,sed,sysvinit
ARCH = x86_64 ARCH = x86_64
URL = http://snaplinux.org URL = http://snaplinux.org
REPO = core REPO = core
@@ -18,7 +18,7 @@ DESC = This package supplies the core required init scripts for startup
ARCHIVE := '' ARCHIVE := ''
SRCDIR := $(PWD)/SRC/initscripts SRCDIR := $(PWD)/SRC/initscripts
PATCHDIR := $(PWD)/SRC/patches PATCHDIR := $(PWD)/SRC/patches
VERSION := 1.9-0 VERSION := 1.11-0
include /usr/share/snap/Makefile.snaplinux include /usr/share/snap/Makefile.snaplinux

View File

@@ -187,15 +187,51 @@ status_of_proc() {
esac esac
done 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 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
echo "Cannot read pid file ($pidfile)"
pid=$(pidofproc "$pathname")
if [ "$?" -eq 0 ]; then
echo "$NAME running with PID: $pid"
else
echo "$NAME is not running"
fi
return 4
fi
else else
pid=$(pidofproc "$pathname") pid=$(pidofproc "$pathname")
fi
if [ "$?" -ne 0 ]; then if [ "$?" -eq 0 ]; then
echo "$NAME is not runing" && return 1 echo "$NAME running with PID: $pid" && return 0
else else
echo "$NAME running with PID: $pid" echo "$NAME is not runing" && return 3
fi
fi fi
} }