Fix the lighttpd process recovery failure
When the lighttpd starts without creating a pid file, SM will restart the process after the audit detects the failure. The init script then kills the current running process and starts a new one. The kill method was using the default port 80, as a result the process that was running without a pid file was not killed. Therefore, ‘Service group web-services degraded’ alarm was never cleared due to recovery failure. This update changes the kill method to kill the process that running on the configured lighttpd port. Change-Id: Id6cae43e315d0def771b9f1422fc7753d57e6710 Closes-Bug: 1844456 Signed-off-by: Tao Liu <tao.liu@windriver.com>
This commit is contained in:
parent
fbc09b8db8
commit
66d88788a8
|
@ -16,18 +16,22 @@ NAME=lighttpd
|
||||||
DESC="Lighttpd Web Server"
|
DESC="Lighttpd Web Server"
|
||||||
OPTS="-f /etc/lighttpd/lighttpd.conf"
|
OPTS="-f /etc/lighttpd/lighttpd.conf"
|
||||||
PIDFILE="/var/run/$NAME.pid"
|
PIDFILE="/var/run/$NAME.pid"
|
||||||
PORT="80"
|
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
|
|
||||||
if lsof -t -i:${PORT} 1> /dev/null 2>&1; then
|
port=$(cat /etc/lighttpd/lighttpd.conf | awk '{if ($1 == "server.port")
|
||||||
kill $(lsof -t -i:${PORT}) > /dev/null 2>&1
|
{ print $3; }}')
|
||||||
|
if [ ! -z "$port" ]; then
|
||||||
|
pid=$(lsof -t -i:${port} 2> /dev/null)
|
||||||
|
if [ ! -z "$pid" ]; then
|
||||||
|
kill ${pid} > /dev/null 2>&1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e $PIDFILE ]; then
|
if [ -e $PIDFILE ]; then
|
||||||
PIDDIR=/proc/$(cat $PIDFILE)
|
pid=$(pidof $NAME 2> /dev/null)
|
||||||
if [ -d ${PIDDIR} ]; then
|
if [ -n "$pid" ]; then
|
||||||
echo "$DESC already running."
|
echo "$DESC already running."
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue