Expect: Difference between revisions

(m)
Line 12:
= Scripts =
 
;==Expect script to ARP Ping==
 
<pre>
Line 33:
0 * * * * /home/ibm/Desktop/expect 2>&1 >> /home/ibm/Desktop/script_output.log
 
;==Expect script to backup Netscaler config==
 
<pre>
Line 52:
 
 
;==TCP three-way handshake by hand using expect==
 
<pre>
Line 134:
puts Done.
</pre>
 
== Reboot Netscaler using Expect ==
<pre>
#!/usr/bin/expect
set timeout 10
spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no nsroot@10.107.88.78
expect "Password"
send "pwd@123\n"
expect "Last login:"
send "reboot\n"
expect ":"
send "Y\r"
sleep 1
exit
</pre>
 
Cron entry to schedule reboot at 2:00AM daily
* 2 * * * /home/test/ns_reboot.sh
 
 
 
 
 
<br />