I have been tasked with making sure that if a particular server at work dies, we know about it right away. Because I'm not there (no one is really), I have written a script to run on my home router linux box (which runs Alpine Linux) to connect to our work Cisco router and ping the server (since the server is not directly accessible from the internet).I have setup passwordless rsa on the Cisco router, and this is the main part of my script:ssh user@work_router 'ping Server_IP' 2>/dev/null | grep -q ' 0 percent'if [[ $? == 0 ]]then    #It's not respondingelse    #Everything is finefiThe scripts works great when run manually, but when I tell cron to run it, it stops working.Redirecting the ssh output to a logfile, I see this is the problem:When running manually, the command gives this output:Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to SERVER_IP, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 msWhen cron runs it, this is the output:Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to SERVER_IP, timeout is 2 seconds:!Is there some reason why ping or ssh is getting interrupted before they complete running?Edit:Running Script from terminal using 'ssh -v -v':http://pastebin.com/YXxbHq3tRunning Script with cron using 'ssh -v -v':http://pastebin.com/wkYiAWsEA vimdiff between these 2 files shows some interesting differences, but it's over my head. Can anyone tell what's going on?
Why does having cron run a remote command over ssh on a Cisco router get interrupted?
ssh;cisco