- 论坛徽章:
- 0
|
#!/bin/sh
LOGFILE=/root/log/test.`date '+%Y%m%d'`
date=`date +%H%M`
for i in `cat ip.txt`
do
port=`nmap $i -p 80 | awk 'NR==5 {print $2}'`
cpu=`snmpwalk -v 1 $i -c public .1.3.6.1.4.1.2021.54 | awk ' NR==5 {print $4 , $5 , $6 , $7}'`
diskname1=`snmpwalk -v 1 $i -c public .1.3.6.1.4.1.2021.55 | awk 'NR==5 {print $4 , $5 , $6 , $7}'`
echo $date $i $port , $cpu , $totaltcp , $diskname1 >> $LOGFILE
done
=======================
#vi crontab后
*/5 * * * * root /bin/sh /root/test.sh
=======================
# tail -f /var/log/cron 后
发现Feb 5 10:20:01 NJCNC-130 crond[28487]: (root) CMD (/bin/sh /root/test.sh)
===============================
没有问题啊!
为什么就是没有输出结果呢? |
|