Score:0

Keep SSH connected until command output completes

us flag

I am trying to setup a Nagios rule that runs an SSH command and outputs the contents to a file. The issue I believe I am running into is that SSH runs the command and closes the connection before the output writes to the file. If I run the script manually from the CLI it works great, but from within Nagios it is writing 0 size files. One file I checked just included the header of the output which leads me to this conclusion.

Is there a way to tell SSH to keep the connection open for a specifiec amount of time before closing it?

Thanks


sshpass -p "password" ssh -v -o StrictHostKeyChecking=no admin@$1 "showconfig" > "/usr/local/nagios/tmp/usa"$1;


mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.