Lines 56-71
Link Here
|
56 |
|
56 |
|
57 |
# Clean up /var/run and create /var/run/utmp so we can login. |
57 |
# Clean up /var/run and create /var/run/utmp so we can login. |
58 |
for x in $(find /var/run/ ! -type d ! -name utmp ! -name innd.pid ! -name random-seed ! -name ld-elf.so.hints); do |
58 |
for x in $(find /var/run/ ! -type d ! -name utmp ! -name innd.pid ! -name random-seed ! -name ld-elf.so.hints); do |
|
|
59 |
[[ ! -f ${x} ]] && continue |
59 |
# Do not remove pidfiles of already running daemons |
60 |
# Do not remove pidfiles of already running daemons |
60 |
if [[ ${x} == *".pid" ]] ; then |
61 |
if [[ ${x} == *".pid" ]] ; then |
61 |
local pid=$(sed -e '1q' "${x}") |
62 |
local pid=$(sed -e '1q' "${x}") |
62 |
if [[ -e /proc/${pid}/cmdline ]] ; then |
63 |
# BSD doesn't have /proc mounted by default |
63 |
continue |
64 |
if [[ -e /proc/self ]] ; then |
|
|
65 |
[[ -e /proc/${pid}/cmdline ]] && continue |
64 |
else |
66 |
else |
65 |
ps -p "${pid}" >/dev/null && continue |
67 |
ps -p "${pid}" >/dev/null && continue |
66 |
fi |
68 |
fi |
67 |
fi |
69 |
fi |
68 |
[[ ! -f ${x} ]] && continue |
|
|
69 |
rm -f "${x}" |
70 |
rm -f "${x}" |
70 |
done |
71 |
done |
71 |
fi |
72 |
fi |