deljil.sh
ckmsce=/home/deljl.exp
aa=root
bb=123456
omplist="
192.168.1.14
192.168.1.15
192.168.1.16
192.168.1.17
192.168.1.18
192.168.1.19
192.168.1.20
192.168.1.21
192.168.1.22
192.168.1.23
192.168.1.24
192.168.1.25
192.168.1.26
192.168.1.27
192.168.1.28
"
port=23
for ompname in $omplist
do
$ckmsce $ompname $aa $bb $port
done
#-------------------------------------
deljl.exp
set date [exec date -d day +'%Y%m%d']
set username [lindex $argv 1]
set password [lindex $argv 2]
set port [lindex $argv 3]
spawn ssh -D $port $username@$desthost
#expect "*assword:*"
#send "$password "
expect {
"*(yes/no)?"
{
send "yes "
expect "*assword:" {send "$password "}
}
"*assword:"
{
send "$password "
}
}
expect "*#"
#send "echo "56 7 * * * cd /home/;./probecheck.sh &" >> /var/spool/cron/root "
send -- "utmpdump /var/log/wtmp > /tmp/wtmp1 && sed -i '/root/d' /tmp/wtmp1 && utmpdump -r /tmp/wtmp1 > /var/log/wtmp "
expect "*#"
send "cd /root "
expect "*#"
send "echo > .bash_history "
expect "*#"
send "echo > .mysql_history "
expect "*#"
send "history -c "
send "exit "
interact