Keeping a program running on Linux server when computer goes to sleep?
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.
Keeping a program running on Linux server when computer goes to sleep?
Hello, I have a CentOS 8 server and I use a GUI program on it via an X windows session.
A few nights ago I was just going to let things run so I SSH into the server from my Windows machine, start up the program, let it run then put my computer to sleep.
When I started up the computer in the morning I realized that I had lost the connection with the Linux server (to be expected if I put the computer to sleep, as the network card is going to go down as well) but my program had also been cut off when I put the computer to sleep. I did not think that through.
Is there any way to keep the GUI program running on the Linux server even if I want to put my Windows computer to sleep at night (the one I connect from)? Otherwise I need to leave my computer on continuously as well.
I use TigerVnc so it connects to a running session on the Linux box. However I have a monitor, keyboard and mouse on the Linux box. If the server is headless, it's trickier to set up but still doable.
if I want to run a GUI session I just VNC to connect to the server. When I disconnect the VNC session it will still be running on the server and I can always reconnect to that session
if I want an SSH session to stay alive, you can use the screen command. When I log in using SSH, I issue the screen command.
It will start up with some information, then I can start anything on the terminal. Then I can disconnect from that running SSH session using <Ctrl-A> and then <d>. I can close the SSH session. When I restart a new SSH session, I can pick up the still running session with the command screen -r
To me it seems that your question is how to keep a SSH session alive, and I use the screen command daily for that. You can even have multiple SSH sessions running in the background in parallel without the need for any open SSH session.
You can do a lot more with the screen command, just check out the MAN page: https://linux.die.net/man/1/screen but this is the simple way I use it..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.