Automatisation à un SLIS via la console d'administration SLIM
Connexion standard :
un fichier issu de slim, connect.expect :
#!/usr/bin/expect -f # This script must be passed to the expect command in a shell # Under kde, you can associate expect files to a 3 lines script like: # # #!/bin/bash # slis=`cat $1 | grep "spawn ssh" |grep -v grep| awk -F @ '{print $2}'` # konsole -T "root@$slis" --caption "root@$slis" -e expect $1 && /bin/rm -f $1 & # the root password for lmc set password "pass" set lcs_password "pass" set host_password "pass" set timeout 30 spawn ssh root@nom-du-slis expect { "word: " { sleep 1;send "$password\r";interact} "(yes/no)?" { sleep 1;send "yes\r" expect "word: " { sleep 1;send "$password\r";interact} } "failed." { send_user "ERROR\n"; expect_user "\n";} }
Sur kde : on cree un fichier commmand-expect.sh :
#!/bin/bash slis=`cat $1 | grep "spawn ssh" |grep -v grep| awk -F @ '{print $2}'` konsole -T "root@$slis" --caption "root@$slis" -e expect $1 && /bin/rm -f $1 &bin/rm -f $1 &
Sur gnome :
#!/bin/bash slis=`cat $1 | grep "spawn ssh" |grep -v grep| awk -F @ '{print $2}'` gnome-terminal --title "root@$slis" -x expect $1 &
Sous Windows :