- 论坛徽章:
- 0
|
小弟在redhat as 3.0上总是不能运行,提示command no found
什么意思?
#!/bin/bash
# Captures time taken for telnet to remote host(s)
# Captures time taken for telnet to remote host(s)
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/etc
SDIR=`dirname ${0}`
IPSCONF="${SDIR}/ips.txt" # file with IPs of hosts to monitor
DATE=`date +%Y%m%d`
LOG="${SDIR}/telnet.log" # log file contains telnet time
sh -c 'telnet 3.32.198.98 <<-EOF 2>/dev/null | grep "Connected" EOF' } 2>&1 | egrep 'IPADDRESS|real|Connected' | tr '\012' ' '
sh -c 'telnet 3.32.198.98 <<-EOF 2>/dev/null | grep "Connected" EOF' } 2>&1 | egrep 'IPADDRESS|real|Connected' | tr '\012' ' '
# parse the file containing IPs
# time sh -c '
# telnet ${IP} <<-EOF 2>/dev/null | grep "Connected"'
grep -v "^#" ${IPSCONF} | while read IP ; do
export IP
[ -z "${IP}" ] && echo "IP Address missing ..." && exit 1
{
echo "IPADDRESS ${IP} `date +'%Y%m%d %H%M%S'`"
time sh -c '
telnet ${IP} <<-EOF 2>/dev/null | grep "Connected"
EOF'
} 2>&1 | egrep 'IPADDRESS|real|Connected' | tr '\012' ' ' |
awk '{print $2" "$3" "$4" "$5" "$9}' >>${LOG} 2>&1
done |
|