I am trying to automate the healthcheck process of a router by running a centralised script from a linux server. I am so far able to access the router server without password prompt using ssh and rsa key pairs, and send in some commands from the server.
For example, I could run this automation script (to overwrite a file):
ssh -t -t admin@$server << EOF del output.txt y show port | save output.txt exit EOF
However, when I send a command "start shell" to initialise the bash shell in the router, i was not able to run a script saved in the router automatically. Instead, i have to type in the command to run the script manually, that is ./script.sh.
ssh -t -t admin@$server << EOF del output.txt y start shell <<EOF ./script.sh # <-------------This doesn't get received by bash EOF
I'm not sure what i can do. If there are any other ways i can run that script and receive the output without manually typing in the command, with or without using ssh or rsa key pairs, im all ears.