Expect: Difference between revisions
→Scripts
(m) |
|||
Line 12:
= Scripts =
<pre>
Line 33:
0 * * * * /home/ibm/Desktop/expect 2>&1 >> /home/ibm/Desktop/script_output.log
<pre>
Line 52:
<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 />
|