Line
Link Here
|
|
-- /lib/rcscripts/net.modules.d/helpers.d/functions |
|
|
Lines 83-95
Link Here
|
83 |
# Removes the given pidfile if the process is not running |
83 |
# Removes the given pidfile if the process is not running |
84 |
# Returns 1 if the process is still running otherwise 0 |
84 |
# Returns 1 if the process is still running otherwise 0 |
85 |
clean_pidfile() { |
85 |
clean_pidfile() { |
86 |
local pidfile=${1} cmd |
86 |
local pidfile=${1} |
87 |
|
87 |
|
88 |
[[ ! -f ${pidfile} ]] && return 0 |
88 |
[[ ! -f ${pidfile} ]] && return 0 |
|
|
89 |
local pid=$( cat ${pidfile} ) |
89 |
|
90 |
|
90 |
cmd=${pidfile##*/} |
91 |
if [[ -n ${pid} ]]; then |
91 |
cmd=${cmd%%-*} |
92 |
local cmd=${pidfile##*/} |
92 |
ps -p $( cat ${pidfile} 2>/dev/null ) | grep -q ${cmd} && return 1 |
93 |
cmd=${cmd%%-*} |
|
|
94 |
ps -p ${pid} 2>/dev/null | grep -q ${cmd} && return 1 |
95 |
fi |
93 |
|
96 |
|
94 |
rm -f ${pidfile} |
97 |
rm -f ${pidfile} |
95 |
return 0 |
98 |
return 0 |