Im working on a ip accounting exercise to log traffic on a NAT router. (following the NAG2 guide). See thread :
http://www.linuxquestions.org/questi...hreadid=182610
In order to clear the iptables counters I have set a cron job (as root) using crontab <file>
5 3 * * * perl /root/ipcounters.pl
this perl script looks like :
-rwx------ 1 root root 1373 May 23 20:55 ipcounters.pl*
#!/usr/bin/perl
$_ = `iptables -L -v`;
do_some_text_extractions($_);
The script runs on schedule, but the syscall to iptables fails (silently). It appears as though its not running as root, which the iptables command requires. Ive tried all sorts of things, read the man pages (poor) some good tuts at:
http://support.gradwell.net/article.php?85
http://en.tldp.org/LDP/lame/LAME/lin...sing-cron.html
The script works fine manually as root, but not under cron. Hmmm.
BTW a related problem ive noticed is that the shebang syntax for perl scripts dont work for some reason.
whereis perl
perl: /usr/bin/perl
-rwx------ 1 root root 1373 May 23 20:55 ipcounters.pl*
[root@fileserver root] ./ipcounters.pl
bash: ./ipcounters.pl: bad interpreter: No such file or directory
perl ipcounters.pl
works ok
Any ideas on those two probs?