寫了一段批量管理的bash小程序,利用了redhat 原生的expect,wget包組。

粘貼下readme:

#myexpect V1.0 released

#auth [email protected]

#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 [yourscript.py] to run python scripts on hosts defined in hosts

├── exc-sh.sh:you can use exec-sh.sh [yourscript.sh] to run bash scripts on hosts defined in hosts

├── hosts.pass:host file likes [ip port username password],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 [yourscript.sh]


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章