Morning all<div><br></div><div>I need to run a command on an internal server that will restart a given service, in this case asterisk, without user intervention. I using this:</div><div><br></div><div>sshpass -p '1qazxsw2' ssh -o StrictHostKeyChecking=no <a href="mailto:root@192.168.50.87">root@192.168.50.87</a> /etc/init.d/asterisk restart</div>
<div><br></div><div>The problem is this command never logs out:</div><div><br></div><div><div>Stopping safe_asterisk: [ OK ]</div><div>Shutting down asterisk: [ OK ]</div><div>Starting asterisk: [ OK ]</div></div><div>
<br></div><div>.... and there it sits, until I manually close it</div><div><br></div><div>I also tried using -t with the ssh command, which closes the session, but without restarting the service, even though it says it did:</div>
<div><br></div><div>$ sshpass -p '1qazxsw2' ssh -o StrictHostKeyChecking=no -t <a href="mailto:root@192.168.50.87">root@192.168.50.87</a> "/etc/init.d/asterisk restart"</div><div><div>Stopping safe_asterisk: [FAILED]</div>
<div>Shutting down asterisk: [FAILED]</div><div>Starting asterisk: [ OK ]</div><div>Connection to 192.168.50.87 closed.</div></div><div><br></div>
<div>I found this article:</div><div><br></div><div><a href="http://www.snailbook.com/faq/background-jobs.auto.html">http://www.snailbook.com/faq/background-jobs.auto.html</a></div><div><br></div><div>And tried:</div><div>
<br></div><div><div>$ sshpass -p '1qazxsw2' ssh -o StrictHostKeyChecking=no <a href="mailto:root@192.168.50.87">root@192.168.50.87</a> /etc/init.d/asterisk restart < /dev/null</div></div><div><br></div><div>which also does not close.</div>
<div><br></div><div>Any ideas on how I can get this to run the way I want it to?</div><div><br clear="all"><div>ed</div>-- <br>Edward Holcroft<br>Madsen Kneppers & Associates Inc.<br>3020 Holcomb Bridge Rd. NW<br>Norcross, GA<br>
30071<br>Tel (770) 446-9606<br>GoogleVoice (678) 587-8649<br><br>WARNING/CONFIDENTIALITY NOTICE:This message may be confidential and/or privileged. If you are not the intended recipient, please notify the sender immediately then delete it - you should not copy or use it for any purpose or disclose its content to any other person. Internet communications are not secure. You should scan this message and any attachments for viruses. Any unauthorized use or interception of this e-mail is illegal.<br>
</div>