#!/usr/bin/expect -f # connect via ssh spawn ssh -p [your_SSH_port_here] root@[your_AA50_IP_address_here] ####################### expect { -re ".*sword.*" { #wait for the password prompt exp_send "[your_AA50_root_password_here]\r" #send root password expect -re ".*root.*" #wait for system prompt exp_send "asterisk -rx 'restart gracefully'\r" #restart Asterisk after calls clear expect -re ".*root.*"#wait for system prompt exp_send "reboot\r" #immediately reboot } } interact