Using sshpass in bash script.
I am connecting to the server, send the command df -h and save the output in a txt file.
It works fine with about 10 servers. I found it doesn't work with some other servers and I don't understand why. Servers are same. So same OS, same hardware etc.
#!/bin/bash
timeout 60 /usr/bin/sshpass -p 'mypassword.' ssh -o StrictHostKeyChecking=no [email protected] /usr/sbin/vtysh > /var/www/output/11-22-33-44.txt << EOF
df -h
EOF
sleep 5;
timeout 60 /usr/bin/sshpass -p 'mypassword.' ssh -o StrictHostKeyChecking=no [email protected] /usr/sbin/vtysh > /var/www/output/55-66-77-88.txt << EOF
df -h
EOF
etc.
In some servers I see only:
/bin/login: invalid option -- q
Tinylogin v1.4 (2018.03.23-08:44+0000) multi-call binary
Usage: login [OPTION]... [username] [ENV=VAR ...]
Options:
-f Do not perform authentication (user already authenticated
-h Name of the remote host for this login.
-p Preserve environment.
Bash script is absolutely same, no changes there (only IP address). Will be very thankful for help.