Commit afcec7a4 authored by Kolbjørn Barmen's avatar Kolbjørn Barmen
Browse files

More pidsfile cleanup

parent 4dd26572
......@@ -8,7 +8,7 @@ apt-get update
apt-get -y upgrade
package="mp-rude"
version="1.3.6"
version="1.3.7"
#version=$(git describe|perl -p -e 'chomp;s/v([^-]+)(-(\d+)-g.+)?$/\1+\3/;s/\+$//')
......
#! /bin/sh
#! /bin/sh
set -e
. /etc/mp-rude/start.conf
log="${logpath}"/"${date}"/"traceroute_$1"
pidfile=${pidfile:-/run/mp-rude.pids}
if [ -f "${pidfile}" ] ; then
......
......@@ -4,9 +4,11 @@ set -e
. /etc/mp-rude/start.conf
if [ ! -e "${logpath}"/pids ]
pidfile=${pidfile:-/run/mp-rude.pids}
if [ ! -e "${pidfile}" ]
then
echo "Pid file does not exist: ${logpath}/pids"
echo "Pid file does not exist: ${pidfile}"
exit
fi
......@@ -14,13 +16,13 @@ if test $1. != . ; then
sleep $1 # wait a few seconds closer to midnight
fi
for pid in $(cat "${logpath}"/pids); do
for pid in $(cat "${pidfile}"); do
if [ -d /proc/"${pid}" ] ; then
grep -q trace.sh /proc/"${pid}"/cmdline && kill ${pid}
fi
done
rm -f "${logpath}"/pids
rm -f "${pidfile}"
# remove empty directories
# remove empty directories
find "${logpath}" -type d -empty -delete
......@@ -4,6 +4,7 @@ set -e
umask 0002
. /etc/mp-rude/start.conf
pidfile=${pidfile:-/run/mp-rude.pids}
mkdir -p "${logpath}"/"${date}"
log="${logpath}"/"${date}"/"traceroute_$1"
......@@ -23,6 +24,6 @@ fi
sleep 60
done
#) 9> $log.lock &
#echo "$!" >> $logpath/pids
#echo "$!" >> ${pidfile}
rmdir --ignore-fail-on-non-empty "${logpath}"/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment