Hi everybody,

I'm making a script to configure SNMP on my SUSE server.
This script is wrote mixing BASH and EXPECT.
It work on RedHat/CentOs et Ubuntu (with some changes)

This is the script :
expect -c "
set timeout 1
spawn ssh root@$IP zypper install -y net-snmp
expect yes/no { send yes\r; exp_continue }
expect password: { send $PWD\r }
sleep 1
exit
"
expect -c "
set timeout 1
spawn scp /usr/local/packages/deploiement/suse/snmpd.conf root@$IP:/etc/snmp/snmpd.conf
expect yes/no { send yes\r; exp_continue }
expect password: { send $PWD\r }
sleep 1
exit
"
expect -c "
set timeout 1
spawn ssh root@$IP chkconfig snmpd on
expect yes/no { send yes\r; exp_continue }
expect password: { send $PWD\r }
sleep 1
exit
"
expect -c "
set timeout 1
spawn ssh root@$IP /etc/init.d/snmpd restart
expect yes/no { send yes\r; exp_continue }
expect password: { send $PWD\r }
sleep 1
exit
"


I don't know why but all the command work if i'm not in the script.
When i launch the script i write IP and PWD, the script make no error but i don't see any changes on my server.

Can you help me please ^^ ?