写了一段批量管理的bash小程序,利用了redhat 原生的expect,wget包组。
粘贴下readme:#myexpect V1.0 released
#auth chentp0601@qq.com
#env description
myexpect server requires:bash is needed ofcource
expect for answer password
vsftpd for client to down load scripts upload files etc.
myexpect client requires:ftp for upload
wget for down load
python possible if you want to run python scripts
#file and direcory description
#files in myexpect server
tree /server-scripts
/server-scripts:scripts in myexpect server
├── exc-py.sh:you can use exec-py.sh to run python scripts on hosts defined in hosts
├── exc-sh.sh:you can use exec-sh.sh to run bash scripts on hosts defined in hosts
├── hosts.pass:host file likes ,you 'd better change it before use it
├── mrelease.sh:run this scripts to cp files in /var/ftp/pub to hosts defined in hosts.pass
└── ssh.exp:this file is used to answer what you asked in shell scripts
tree /var/ftp/pub/:you can put you scripts here,and it will be run on hosts defined in hosts.pass when you run exc-py or exc-sh on myexpect-server
/var/ftp/pub/
├── gatherinformation-2.0.py:python scripts
├── oscheck.sh:bash scripts
├── storage_check.sh:bash scripts
└── uploadreport.sh:bash scripts
#files in myexpect client
tree /client-scripts/
/client-scripts/
├── gatherinformation-2.0.py:python scripts
├── oscheck.sh:bash scripts
├── storage_check.sh:bash scripts
└── uploadreport.sh:bash scripts
#how to use myexpect?
1)put yourscript in /var/ftp/pub
2)/server-scripts/mrelease
3)/server-scripts/exc-sh
附件:http://down.51cto.com/data/2367393
页:
[1]