The script can use set variables for the address or user/password if you so desire.
------------------------------ SOF -----------------------
!/usr/bin/expect -f
# Set variables
set host [lindex $argv 0]
set user myusername
set passw mypassword
#
#
#
spawn ssh -p 22 -o ConnectionAttempts=5 -o ConnectTimeout=60 -o StrictHostKeyChecking=no $user\@$host
#
#
expect "assword:"
send "$passw\n"
expect "FGT"
send " config global\n"
expect "(global)"
send "execute reboot\n"
expect "(y/n)"
send "y\n"
expect "onnect"
------------------------------------ EOF ------
You can run it using any of the following;
e.g
(unix at)
at -f <filename > 23:00
( for quick execution)
(unix cron)
59 23 * * * <filename>
>/dev/null 2>&1
( regular daily or weekly or monthly execution )
Ken Felix
NSE ( Network Security Expert) and Route/Switching Engineer.
kfelix -----a----t---- socpuppets ---dot---com
^ ^
=( * * )=
o
/ \
No comments:
Post a Comment