打印

sos

sos

1. 配置文件
[root@yhjx monitor-sys]# pwd
/root/monitor-sys
[root@yhjx monitor-sys]# more ./monitor-config.txt
dir|df -h|w

2.执行文件
[root@yhjx monitor-sys]# pwd
/root/monitor-sys
[root@yhjx monitor-sys]# more monitor.sh
#! /bin/bash
i=1
IFS="|"
JAVA_=java
PATH=$PATH:/bin/
for program_ in `cat monitor-config.txt `

do
  echo $i: $program_
  `$program_`
let i=$i+1
done

echo "game over"


-------------

[root@yhjx monitor-sys]# pwd
/root/monitor-sys
[root@yhjx monitor-sys]# ./monitor.sh
1: dir
./monitor.sh: line 10: monitor-config.txt  monitor.sh   monitor.sh.bak: command not found
2: df -h
./monitor.sh: line 10: df -h: command not found -- 谁能告诉我为什么会 df -h 不能执行呢
3: w
./monitor.sh: line 10:  19:22:05 up 13 days,  3:18,  3 users,  load average: 0.06, 0.07, 0.03
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/2    192.168.0.110    12:49    6:29m  0.06s  0.00s tail -f catalin
root     pts/3    -                04Jun08  9days  0.07s  0.07s -bash
root     pts/4    192.168.0.110    12:52    0.00s 41.29s  0.00s /bin/bash ./mon: No such file or directory

TOP

TOP


感谢一直以来您对我们的支持!
当前时区 GMT+8, 现在时间是 2008-11-22 20:52 京ICP证060528 号

Designed By 17DST