[afnog] mv not mv-ing :-(

Frank Habicht geier-lists-afnog at tih.co.tz
Wed Sep 19 10:58:45 UTC 2007


Hi,

details below.
it's a FreeBSD box (6.0) and i want to run flowd.
well, maybe the fact that I want to run flowd 0.9 on FreeBSD 6.0
is part of the problem??

i want to rotate the flowd flow data log file regularly, automatically, cron
will come to mind - later.

it the "run_vipimo_stats.sh" script below the 'mv' between the 2 'echo $?'
doesn't seem to do what i want (still the echo says result was no error
i've tried the mv with a -f , with -v here and without those  -- same.



[root at mx3 vipimo]# pwd
/home/frank/vipimo
[root at mx3 vipimo]# cat run_vipimo_stats.sh
#!/bin/sh

FLOWDIR=/var/log/flowd
#FLOWARCHIVEDIR=${FLOWDIR}/archive
FLOWLOGFILE=${FLOWDIR}/flowd
MYFLOWFILE=${FLOWDIR}/flowd-`date '+%F-%H-%M-%S'`
VIPIMODIR=/home/frank/vipimo
CRUNCH_PROG=${VIPIMODIR}/vipimo_crunch.pl
NLRI_FILE=${VIPIMODIR}/data/nlri.txt
NLRI_URL="http://vipimo.eaix.net/data/nlri.txt"

cd ${FLOWDIR}
echo $?
mv -v flowd flowd-`date '+%F-%H-%M-%S'`
echo $?
#/bin/mv  ${FLOWLOGFILE} ${MYFLOWFILE}
kill -HUP `cat /var/run/flowd.pid`
if (date '+%M' | grep '^0'>/dev/null) then
# /usr/local/bin/wget -q -O ${NLRI_FILE} ${NLRI_URL}
fi

#run_perl_cruncher
cd ${VIPIMODIR}
/usr/local/bin/flowd-reader ${MYFLOWFILE} | ${CRUNCH_PROG}

#rm or mv
if [ "${FLOWARCHIVEDIR}" ]; then
 /bin/mv -f ${MYFLOWFILE} ${FLOWARCHIVEDIR}/ 2>/dev/null
else
 /bin/rm -f ${MYFLOWFILE} 2>/dev/null
fi

[root at mx3 vipimo]# date
Tue Sep 18 20:22:44 EAT 2007
[root at mx3 vipimo]# /bin/sh run_vipimo_stats.sh
0
flowd -> flowd-2007-09-18-20-23-07
0
isp:1 ixp:1 0 0 0 0 ./rrd/traffic_isp_1_ixp_1.rrd
isp:1 ixp:2 0 0 0 0 ./rrd/traffic_isp_1_ixp_2.rrd
isp:1 ixp:3 0 0 0 0 ./rrd/traffic_isp_1_ixp_3.rrd
isp:1 ixp:4 0 0 0 0 ./rrd/traffic_isp_1_ixp_4.rrd
aggregate with ixp:1 0 0 0 0 ./rrd/aggregate_ixp_1.rrd
aggregate with ixp:2 0 0 0 0 ./rrd/aggregate_ixp_2.rrd
aggregate with ixp:3 0 0 0 0 ./rrd/aggregate_ixp_3.rrd
aggregate with ixp:4 0 0 0 0 ./rrd/aggregate_ixp_4.rrd
[root at mx3 vipimo]# l /var/log/flowd/
total 6
drwxrwx---  2 root  wheel   512 Sep 18 20:23 ./
drwxr-xr-x  5 root  wheel  2560 Sep 18 20:00 ../
-rw-------  1 root  wheel     0 Sep 18 20:23 flowd
-rw-------  1 root  wheel     0 Sep 14 22:43 flowd-2007-09-14-22-44-23
[root at mx3 vipimo]#


as per the date shown i expected to get a file
/var/log/flowd/flowd-2007-09-18-20-23-07
but can't really see it...
the 'l' in the last command is an alias for 'ls -la' btw.

now the strange thing
It works on another 6.2 FreeBSD box (was fresh 6.2 install)

and even stranger:
I updated the 6.0 to a 6.2 FreeBSD - looks good (for a first), but that script
still doesn't "mv" :-(

Now, before I start crying, I thought I ask you guys.

Thanks,
Frank




More information about the afnog mailing list