Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hey all-
I'm wondering if there's a way to issue commands toa remote machine without having the terminal actaully log in to the remote machine. Basically, I want to tell the remote box to run a script that I scp'd into it earlier in the script. Here's what I'm thinking:
I've been using the ssh and then executing the script on the remote machine, but that means I have to wait till it's done running before I can exit and get back into the script on my home machine. Since that takes about 2 hours, it's not exactly convenient . Any thoughts?
Check out nohup, i.e. By using nohup commands can finnish after you logout. By adding a & to the command, it will be runned in the background. I thing you should be able to fix it that way
Hm... I don't think screen is what I'm looking for. I only need one terminal up locally, I just need to be able to exit from remote machines and have them keep running their script. i tried doing nohup bash myscript &, but it hung up for some reason, never returning me to the prompt...
Hm... I don't think screen is what I'm looking for. I only need one terminal up locally, I just need to be able to exit from remote machines and have them keep running their script. i tried doing nohup bash myscript &, but it hung up for some reason, never returning me to the prompt...
This is still doable with screen.
Once you login to the remote machine execute "shell".
Once you are inside of the shell you can then execute your command, once you have done so you can detach the shell while the command still runs.
Code:
ctrl-a-d
This will detach the shell, even if you log out of the remote machine the command will still be running.
Once you return to the machine you just run 'screen -r' to bring the shell back.
Thanks for the tips! It appears that screen will work for this. The concept is still a bit hazy to me, but as long as it works, I'm okay with it. Thanks!
Last edited by JDska55; 06-30-2009 at 01:49 PM.
Reason: not paying attention
The ability to re-attach to a screen session is one of the cool features, that I really like..
I used to host some game servers on Linux and would run them in screen sessions so I could remote into the system attach to the screen to manage the server, detach then log off the remote box.
I had a consultant remote into a system once and he ran a screen session which we then attached to locally so we could watch everything he did on the server.. Was rather slick.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.