dimanche 10 janvier 2016

if else statement in expect script

I am trying to create a script which will "send" input as per the output received from executing the previous script.

#!/usr/bin/expect --
set timeout 60

spawn ssh user@server1

expect "*assword*" { send "password\r"; }

expect "*$*" { send "./jboss.sh status \r"; }
if [ expect "*running*" ];
        then { send "echo running \r"; }
else { send "./jboss.sh start \r"; }
fi

I am trying to do something like this, but stuck in if else statement. Please suggest something. Thanks!

Aucun commentaire:

Enregistrer un commentaire