I'm wrong! Uh! Take that mister know-it-all.
Check out:
http://www.faqs.org/faqs/unix-faq/faq/part3/section-2.html
(God I've got some issues)
-Ross
----- Original Message ----- From: centos-bounces@centos.org centos-bounces@centos.org To: centos@centos.org centos@centos.org Sent: Mon Mar 17 18:39:07 2008 Subject: Re: [CentOS] remote command execution
I got the BSD and negate forms mixed up and forgot the &.
C:\rsh host "stty -hup; command&"
-Ross
----- Original Message ----- From: centos-bounces@centos.org centos-bounces@centos.org To: centos@centos.org centos@centos.org Sent: Mon Mar 17 18:27:58 2008 Subject: Re: [CentOS] remote command execution
Use rsh and in the remote command preface it with stty -nohup, like such:
C:\rsh <host> "stty -nohup;<command>"
This will tell the command to disassociate from the shell.
-Ross
----- Original Message ----- From: centos-bounces@centos.org centos-bounces@centos.org To: 'centos@centos.org' centos@centos.org Sent: Mon Mar 17 18:13:48 2008 Subject: [CentOS] remote command execution
I need to launch a job remotely from a Windows machine on a CentOS box, the caveat is that I can't maintain a connection once I have initiated the job. Anyone got an idea how I can accomplish this?
Thanks! jlc _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
________________________________
This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof.
________________________________
This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof.
______________________________________________________________________ This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof.
I'm wrong! Uh! Take that mister know-it-all.
Check out:
http://www.faqs.org/faqs/unix-faq/faq/part3/section-2.html
(God I've got some issues)
-Ross
Heh, I see the example for sh and I am note to sure exactly what it's doing but I will give it a try! That looks most promising as Win2k3 has an rsh client which keeps me safe for not installing any third party ware on the client that needs to initiate the command.
Thanks! jlc
I won't allow rsh to contact my CentOS machines. ssh, ssl, http, but no rsh. Too insecure, especially from a Windows machine.
Ken Wolcott
On Mon, Mar 17, 2008 at 4:24 PM, Joseph L. Casale jcasale@activenetwerx.com wrote:
I'm wrong! Uh! Take that mister know-it-all.
Check out:
http://www.faqs.org/faqs/unix-faq/faq/part3/section-2.html
(God I've got some issues)
-Ross
Heh, I see the example for sh and I am note to sure exactly what it's doing but I will give it a try! That looks most promising as Win2k3 has an rsh client which keeps me safe for not installing any third party ware on the client that needs to initiate the command.
Thanks! jlc
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Kenneth Wolcott wrote:
I won't allow rsh to contact my CentOS machines. ssh, ssl, http, but no rsh. Too insecure, especially from a Windows machine.
Rsh uses only the source IP for authentication - which might be OK on well firewalled internal networks but it generally is not used these days. The same concept will work from ssh too, where you can use keys for passwordless access. Just ssh host 'nohup command &'
On the other hand, if you'd like to be able to reconnect later with the same things running, you might set up freenx and use the NX client to connect. That way you get a complete GUI desktop session that you can suspend (with everything still running) and connect back later.
Rsh uses only the source IP for authentication - which might be OK on well firewalled internal networks but it generally is not used these days. The same concept will work from ssh too, where you can use keys for passwordless access. Just ssh host 'nohup command &'
On the other hand, if you'd like to be able to reconnect later with the same things running, you might set up freenx and use the NX client to connect. That way you get a complete GUI desktop session that you can suspend (with everything still running) and connect back later.
-- Les Mikesell lesmikesell@gmail.com
Ok, so Ross was right to begin with? Ssh is fine as well, I can execute putty with in my realm. Thanks everyone! jlc
nohup will allow you to run a command that is not connected to the shell:
nohup command >> nohup.log &
On Mon, Mar 17, 2008 at 5:24 PM, Joseph L. Casale jcasale@activenetwerx.com wrote:
I'm wrong! Uh! Take that mister know-it-all.
Check out:
http://www.faqs.org/faqs/unix-faq/faq/part3/section-2.html
(God I've got some issues)
-Ross
Heh, I see the example for sh and I am note to sure exactly what it's doing but I will give it a try! That looks most promising as Win2k3 has an rsh client which keeps me safe for not installing any third party ware on the client that needs to initiate the command.
Thanks! jlc
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
nohup will allow you to run a command that is not connected to the shell:
nohup command >> nohup.log &
Devin, What is the correct way to encapsulate the command if its rather long. Just as a test, I am trying to run `dd if=/dev/random of=~/test bs=1024 count=50000` so that I can disconnect and watch it run...
A possible caveat is that I was using plink.exe to connect and execute the command and I suspect the syntax issue might be a windows shell issue.
Thanks! jlc
Joseph L. Casale wrote:
nohup will allow you to run a command that is not connected to the shell:
nohup command >> nohup.log &
Devin, What is the correct way to encapsulate the command if its rather long. Just as a test, I am trying to run `dd if=/dev/random of=~/test bs=1024 count=50000` so that I can disconnect and watch it run...
A possible caveat is that I was using plink.exe to connect and execute the command and I suspect the syntax issue might be a windows shell issue.
put everything in a shell script, and run the script.
put everything in a shell script, and run the script.
Yea, I tried that but neglected to see how it behaved from inside an ssh session. It works there but with plink :( Back to the drawing board... jlc
For those that followed, a working solution came from a helpful soul in an ssh list when looking for putty/plink help! `echo "command" | at now` when sent via plink returned control back immediately and allowed execution to take place making the Windows script side happy. jlc
Joseph L. Casale wrote:
put everything in a shell script, and run the script.
Yea, I tried that but neglected to see how it behaved from inside an ssh session. It works there but with plink :( Back to the drawing board...
I just tried:
% cat /tmp/test.sh nohup /usr/bin/tail -f /tmp/test.in > /tmp/test.out 2>&1 &
(note that all output is redirected)
C:> plink user@host /tmp/test.sh ... C:>
on the remote host % echo "10" >> /tmp/test.in % cat /tmp/test.out ... 10 % ps ax|grep tail ... /usr/bin/tail -f /tmp/test.in
I just tried:
% cat /tmp/test.sh nohup /usr/bin/tail -f /tmp/test.in > /tmp/test.out 2>&1 &
(note that all output is redirected)
C:> plink user@host /tmp/test.sh ... C:>
on the remote host % echo "10" >> /tmp/test.in % cat /tmp/test.out ... 10 % ps ax|grep tail ... /usr/bin/tail -f /tmp/test.in
Right, but do something that takes a while, like a large dd from /dev/random and see what plink does :)
jlc
Joseph L. Casale wrote:
I just tried:
% cat /tmp/test.sh nohup /usr/bin/tail -f /tmp/test.in > /tmp/test.out 2>&1 &
(note that all output is redirected)
C:> plink user@host /tmp/test.sh ... C:>
on the remote host % echo "10" >> /tmp/test.in % cat /tmp/test.out ... 10 % ps ax|grep tail ... /usr/bin/tail -f /tmp/test.in
Right, but do something that takes a while, like a large dd from /dev/random and see what plink does :)
Can you give an actual example of something that fails?
Can you give an actual example of something that fails?
-- Les Mikesell
Les, it's not that it fails it is just that plink sends the command and waits for it to complete execution. Even if the shell script uses your nohup syntax, if I put in a long dd as a test command then have plink execute the script, it will actually wait for it to complete and even show dd's output! Sending the command to at worked perfectly!
jlc
Joseph L. Casale wrote:
Can you give an actual example of something that fails?
--
Les, it's not that it fails it is just that plink sends the command and waits for it to complete execution. Even if the shell script uses your nohup syntax, if I put in a long dd as a test command then have plink execute the script, it will actually wait for it to complete and even show dd's output! Sending the command to at worked perfectly!
That means you left one or all of the remote shell's stdin/out/error connected (not surprising, since the example earlier only redirected a subshell) and the ssh connection is waiting for them to close. Try running the nohup as part of the actual command line - and you may need to add an </dev/null - or do an exec </dev/null >output_file 2>error_file and exit. Check the man page for 'nohup'. It will redirect sdtout and error if you don't, but I've forgotten if it does anything with stdin.