<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Send Remote Commands Via SSH</title>
	<atom:link href="http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/feed" rel="self" type="application/rss+xml" />
	<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html</link>
	<description>Big, Honkin' Systems Stuff</description>
	<lastBuildDate>Sat, 21 Aug 2010 15:28:49 -0700</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: SSH Executing Remote Commands &#124; bryanstamour.com</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-1680</link>
		<dc:creator>SSH Executing Remote Commands &#124; bryanstamour.com</dc:creator>
		<pubDate>Sun, 27 Jun 2010 17:15:08 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-1680</guid>
		<description>[...] you can pass the -t flag to ssh. I didn&#8217;t know this before, I found out today while reading systemsboy&#8217;s [...]</description>
		<content:encoded><![CDATA[<p>[...] you can pass the -t flag to ssh. I didn&#8217;t know this before, I found out today while reading systemsboy&#8217;s [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: davessh -p 8222 smtp1.sound-i.co.uk 'screen -rd'</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-1620</link>
		<dc:creator>davessh -p 8222 smtp1.sound-i.co.uk 'screen -rd'</dc:creator>
		<pubDate>Mon, 24 May 2010 17:26:35 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-1620</guid>
		<description>silky, i use the -t to reattach my screen session once ssh has connected (using keyless logins). Moist, now i can run one command, connect to my chat server and reattach my screen so my irc stays connected permantly. Nice!!</description>
		<content:encoded><![CDATA[<p>silky, i use the -t to reattach my screen session once ssh has connected (using keyless logins). Moist, now i can run one command, connect to my chat server and reattach my screen so my irc stays connected permantly. Nice!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jussi</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-1588</link>
		<dc:creator>Jussi</dc:creator>
		<pubDate>Mon, 03 May 2010 07:55:36 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-1588</guid>
		<description>@systemsboy and @Razi:
One scenario where you would like to have behaviour like described is when you would like to attach to a remote screen automatically (with for example &quot;screen -dr&quot;) but would also like to later detach the screen to be able to do something else on the server. 

If the run command is only &quot;screen -dr&quot; the detaching from the screen session would also log you out. Ouch. I personally use &quot;screen -dr &amp;&amp; bash -i&quot; as the command to run. It&#039;s not the most beautiful approach but seems to work.

Why do I want it? I run screen+irssi on a remote server. Whenever my internet connection breaks for long enough time for the ssh session to break, I want to be able to reconnect and be ready for IRC business as  soon as possible with as little hassle as possible :)</description>
		<content:encoded><![CDATA[<p>@systemsboy and @Razi:<br />
One scenario where you would like to have behaviour like described is when you would like to attach to a remote screen automatically (with for example &#8220;screen -dr&#8221;) but would also like to later detach the screen to be able to do something else on the server. </p>
<p>If the run command is only &#8220;screen -dr&#8221; the detaching from the screen session would also log you out. Ouch. I personally use &#8220;screen -dr &amp;&amp; bash -i&#8221; as the command to run. It&#8217;s not the most beautiful approach but seems to work.</p>
<p>Why do I want it? I run screen+irssi on a remote server. Whenever my internet connection breaks for long enough time for the ssh session to break, I want to be able to reconnect and be ready for IRC business as  soon as possible with as little hassle as possible <img src='http://systemsboy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-436</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Wed, 30 Jul 2008 22:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-436</guid>
		<description>With openssh you can set a ConnectTimeout... &lt;br/&gt;ssh -o ConnectTimeout=8 blah blah&lt;br/&gt;&lt;br/&gt;Timeout is in seconds.</description>
		<content:encoded><![CDATA[<p>With openssh you can set a ConnectTimeout&#8230; <br />ssh -o ConnectTimeout=8 blah blah</p>
<p>Timeout is in seconds.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: systemsboy</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-435</link>
		<dc:creator>systemsboy</dc:creator>
		<pubDate>Tue, 01 Jul 2008 23:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-435</guid>
		<description>Razi,&lt;br/&gt;&lt;br/&gt;The end of the command should not log you out of the Terminal. It should only log you out of the machine you&#039;re SSHing to. If you don&#039;t want to log out of that machine, there&#039;s not really any reason to use this method. Just SSH into the machine and run your command(s). Then log out when you&#039;re good and ready.&lt;br/&gt;&lt;br/&gt;Or, to answer your question more directly, I don&#039;t know of a way to do this, but I don&#039;t really know why you&#039;d need to either.&lt;br/&gt;&lt;br/&gt;-systemsboy</description>
		<content:encoded><![CDATA[<p>Razi,</p>
<p>The end of the command should not log you out of the Terminal. It should only log you out of the machine you&#8217;re SSHing to. If you don&#8217;t want to log out of that machine, there&#8217;s not really any reason to use this method. Just SSH into the machine and run your command(s). Then log out when you&#8217;re good and ready.</p>
<p>Or, to answer your question more directly, I don&#8217;t know of a way to do this, but I don&#8217;t really know why you&#8217;d need to either.</p>
<p>-systemsboy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Razi</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-434</link>
		<dc:creator>Razi</dc:creator>
		<pubDate>Fri, 27 Jun 2008 05:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-434</guid>
		<description>How do I accomplish the same task but after I terminate the command, I want to remain logged into the terminal?</description>
		<content:encoded><![CDATA[<p>How do I accomplish the same task but after I terminate the command, I want to remain logged into the terminal?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: systemsboy</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-433</link>
		<dc:creator>systemsboy</dc:creator>
		<pubDate>Wed, 23 Jan 2008 20:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-433</guid>
		<description>Yup. Nothing like a good ol&#039; for loop. You could do similar with a simple list of computer names:&lt;br/&gt;for computer in `cat computers.txt`; do ssh -t user@$computer.domain &#039;ls /Applications&#039;; done&lt;br/&gt;&lt;br/&gt;Love it!&lt;br/&gt;&lt;br/&gt;-systemsboy</description>
		<content:encoded><![CDATA[<p>Yup. Nothing like a good ol&#8217; for loop. You could do similar with a simple list of computer names:<br />for computer in `cat computers.txt`; do ssh -t user@$computer.domain &#8216;ls /Applications&#8217;; done</p>
<p>Love it!</p>
<p>-systemsboy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kernalpanx</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-432</link>
		<dc:creator>kernalpanx</dc:creator>
		<pubDate>Wed, 23 Jan 2008 20:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-432</guid>
		<description>when u have more then one server to do that too...... with a good naming convention you can laways use the for command&lt;br/&gt;for i in 1 2 3 4 5 6 7 8 9 10 11 ; do ssh admin@fileserver$i.domain.com &#039;date&#039; &#039;cd / ; du -sh /* ; done&lt;br/&gt;&lt;br/&gt;etc etc</description>
		<content:encoded><![CDATA[<p>when u have more then one server to do that too&#8230;&#8230; with a good naming convention you can laways use the for command<br />for i in 1 2 3 4 5 6 7 8 9 10 11 ; do ssh admin@fileserver$i.domain.com &#8216;date&#8217; &#8216;cd / ; du -sh /* ; done</p>
<p>etc etc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: linux_newbie8478</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-431</link>
		<dc:creator>linux_newbie8478</dc:creator>
		<pubDate>Thu, 06 Dec 2007 01:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-431</guid>
		<description>Hi,&lt;br/&gt;&lt;br/&gt;I&#039;m writing a small python script, which should ssh to 5 diff boxes and get the result for uptime from each box. I want to run this as a daemon process so that I know the least loaded box at any time.&lt;br/&gt;&lt;br/&gt;This can be easily done using a simple for loop around -&lt;br/&gt;load = str(commands.getoutput(&quot;ssh &quot; + machine[0]+ &quot; uptime&quot;))&lt;br/&gt;&lt;br/&gt;But the problem arises when 1 of the 5 remote machines is down. The script just waits for a response from that machine and does not move on to the next box&lt;br/&gt;&lt;br/&gt;How do I instruct the ssh cmd to timeout after say 1 min?&lt;br/&gt;&lt;br/&gt;This can be achieved using a Timer thread in the python script, but it would be much easier if ssh had a switch for the same.&lt;br/&gt;&lt;br/&gt;Unfortunately I can&#039;t locate anything in the man pages for ssh&lt;br/&gt;&lt;br/&gt;BTW I&#039;m using -&lt;br/&gt;$ ssh -V&lt;br/&gt;OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090701f&lt;br/&gt;$ &lt;br/&gt;&lt;br/&gt;Thanks for your help</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I&#8217;m writing a small python script, which should ssh to 5 diff boxes and get the result for uptime from each box. I want to run this as a daemon process so that I know the least loaded box at any time.</p>
<p>This can be easily done using a simple for loop around -<br />load = str(commands.getoutput(&#8220;ssh &#8221; + machine[0]+ &#8221; uptime&#8221;))</p>
<p>But the problem arises when 1 of the 5 remote machines is down. The script just waits for a response from that machine and does not move on to the next box</p>
<p>How do I instruct the ssh cmd to timeout after say 1 min?</p>
<p>This can be achieved using a Timer thread in the python script, but it would be much easier if ssh had a switch for the same.</p>
<p>Unfortunately I can&#8217;t locate anything in the man pages for ssh</p>
<p>BTW I&#8217;m using -<br />$ ssh -V<br />OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090701f<br />$ </p>
<p>Thanks for your help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: systemsboy</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-430</link>
		<dc:creator>systemsboy</dc:creator>
		<pubDate>Tue, 14 Nov 2006 18:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-430</guid>
		<description>Ashley,&lt;br /&gt;&lt;br /&gt;Excellent! Thank you!&lt;br /&gt;&lt;br /&gt;-systemboy</description>
		<content:encoded><![CDATA[<p>Ashley,</p>
<p>Excellent! Thank you!</p>
<p>-systemboy</p>
]]></content:encoded>
	</item>
</channel>
</rss>
