i have a script below that returns remote sendmail stats by telneting to a port. on the remote machine, xinetd runs mailstats on port 88889. when i run the script on command line or when i run a manual `php ~/cmd.php` i get correct data. but when the cmd.php cronjob runs i get all U's. is there a way i can get more data in the logs? any ideas on whats wrong will be greatly appreciated.
* when run from crontab
CMD: /usr/bin/rrdtool update /var/www/html/cacti/rra/sendmail.rrd --template msgsfr:msgsto:kbfr:kbto:msgsrej:msgsdis N:U:U:U:U:U:U
* when run manually
CMD: /usr/bin/rrdtool update /var/www/html/cacti/rra/sendmail.rrd --template msgsfr:msgsto:kbfr:kbto:msgsrej:msgsdis N354236271:0:0
#!/bin/bash
if [ $2 = relay ]; then
relay=`telnet $1 88889 | grep "^ 7"`
msgsfr=`echo $relay | awk '{print $2}'`
msgsto=`echo $relay | awk '{print $4}'`
kbfr=`echo $relay | awk '{print $3}' | cut -dK -f1`
kbto=`echo $relay | awk '{print $5}' | cut -dK -f1`
msgsrej=`echo $relay | awk '{print $6}'`
msgsdis=`echo $relay | awk '{print $7}'`
elif [ $2 = esmtp ]; then
esmtp=`telnet $1 88889 | grep "^ 4"`
msgsfr=`echo $esmtp | awk '{print $2}'`
msgsto=`echo $esmtp | awk '{print $4}'`
kbfr=`echo $esmtp | awk '{print $3}' | cut -dK -f1`
kbto=`echo $esmtp | awk '{print $5}' | cut -dK -f1`
msgsrej=`echo $esmtp | awk '{print $6}'`
msgsdis=`echo $esmtp | awk '{print $7}'`
fi
echo $msgsfr $msgsto $kbfr $kbto $msgsrej $msgsdis
no data when run in crontab, but data when run manually
Moderators: Developers, Moderators
Who is online
Users browsing this forum: No registered users and 5 guests