Commit e16602ea authored by Kolbjørn Barmen's avatar Kolbjørn Barmen

Bare rydde litt i formattering av shell-script

parent 3d9b1df1
Pipeline #17298 passed with stages
in 56 seconds
......@@ -5,7 +5,8 @@
# pick interface with default route
IF=`ip route get 158.38.62.1 | perl -ne 'print $1 if / dev (\w+) /'`
if test "$IF" != ""; then
tomidnight=$((`date --date 'tomorrow 00:00' +%s`-`date +%s` - 1))
if test "$IF" != ""
then
tomidnight=$((`date --date 'tomorrow 00:00' +%s`-`date +%s` - 1))
/usr/sbin/tcpdump -i $IF -G $tomidnight -W 1 -w ${logpath}/icmp-%F-%T.pcap icmp 2> ${logpath}/icmp.log
fi
......@@ -7,19 +7,19 @@ set -e
log="${logpath}"/"${date}"/"traceroute_$1"
pidfile=${pidfile:-/run/mp-rude.pids}
if [ -f "${pidfile}" ] ; then
if [ -f "${pidfile}" ]
then
echo "ERROR: ${pidfile} already exists!"
exit 1
fi
#Start traceroute
for i in $(cat ${traceconf}) ; do
for i in $(cat ${traceconf})
do
${trace} ${i} 23:59 > /dev/null 2>&1 &
echo "$!" >> "${pidfile}"
done
done
# start tcpdump og icmp
$bin/start-icmp
......@@ -7,20 +7,23 @@ set -e
pidfile=${pidfile:-/run/mp-rude.pids}
if [ ! -e "${pidfile}" ]
then
then
echo "Pid file does not exist: ${pidfile}"
exit
fi
if test $1. != . ; then
sleep $1 # wait a few seconds closer to midnight
if test $1. != .
then
sleep $1 # wait a few seconds closer to midnight
fi
for pid in $(cat "${pidfile}"); do
if [ -d /proc/"${pid}" ] ; then
grep -q trace.sh /proc/"${pid}"/cmdline && kill ${pid}
fi
done
for pid in $(cat "${pidfile}")
do
if [ -d /proc/"${pid}" ]
then
grep -q trace.sh /proc/"${pid}"/cmdline && kill ${pid}
fi
done
rm -f "${pidfile}"
......
......@@ -9,20 +9,23 @@ pidfile=${pidfile:-/run/mp-rude.pids}
mkdir -p "${logpath}"/"${date}"
log="${logpath}"/"${date}"/"traceroute_$1"
if test $2. -ne . ; then
if test $2. -ne .
then
end=$(date --date "$2" +%s)
else
else
end=$(date --date "2099-12-31" +%s)
fi
# ( flock -n 9 || ( echo "=== could not start traceroute - locked $log.lock ===" ; exit 1 )
# > $log.log
while test $(date +%s) -lt ${end} ; do
while test $(date +%s) -lt ${end}
do
date "+%s starttime %T" | gzip -c >> ${log}.gz
traceroute -q 6 -n $1 2> /dev/null | gzip -c >> ${log}.gz
sleep 60
done
#) 9> $log.lock &
#echo "$!" >> ${pidfile}
......
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