Hi, I am new to this forums, so not having much idea about the posting. But I think that I am posting in correct section (hope). Now I am having problem with the shell script SSH. It is not working accordingly. So thought that some members over there would contribute some help. I have a zabbix server version of Linux kernel 2.6.26-2-amd64 is running. Now my question how can I make a script that does:
- Connect with ssh to a device
- Get systeminfo (but only interfaces, MAC address, serial number and software version)
- Write the output to a file
Now I have this code but it doesn't work:
Code:
# / Bin / bash
# / Usr / bin / expect -
spawn ssh user @ IP> / Infomania / test / juniper / file.txt
expect password:
send "password \ r"
send "get system | mac includes | Int | Ser | Software
expect eof
Now, when I start the script I get the following error message:
Code:
Errormessage:
./ZAJOH01_IP.sh: Line 3: spawn: command not found
Could not read file "password:": no such file or directory
./ZAJOH01_IP.sh: Line 5: send: command not found
./ZAJOH01_IP.sh: Line 6: send: command not found
Could not read file "eof": no such file or directory
If the tip of the command only works means that I write:
Code:
ssh user @ IP> / Infomania / test / juniper / file.txt
Password
get system | mac includes | Int | Ser | Software
exit
then write it in the file / Information / test / juniper / file.txt:
Code:
Remote Management Console
Device-> get system | mac includes | Int | Ser | Soft
Serial Number: xxxxxxxxxxxxxx, Control Number: 00000000
Software Version: 5.xx.xrxx.x, Type: Firewall + VPN
Base Mac: 0010.db44.xxxx
Use interface IP, Config Port: 8005
User Name: ig-root
Interface ethernet1:
* Ip mac 10.182.128.14/23 0010.db44.xxxx
* Manage ip 10.182.128.14, mac 0010.db44.xxxx
Ethernet2 Interface:
* Ip 0.0.0.0 / 0 mac 0010.db44.xxxx
Ethernet3 Interface:
* Ip 0.0.0.0 / 0 mac 0010.db44.xxxx
Ethernet4 Interface:
* Ip mac 196.30.139.43/28 0010.db44.xxxx
* Manage ip 196.30.139.43, mac 0010.db44.xxxx
Device-> exit
I am new to shell scripts and perl so plz help i need it for my work
Bookmarks