![]() |
|
|
#1 |
|
Aug 2020
1000111012 Posts |
I have a headless machine that I only access via SSH. I'm currently using tmux to keep yafu/cado etc running after I log off. Is that the best choice here?
|
|
|
|
|
|
#2 |
|
If I May
"Chris Halsall"
Sep 2002
Barbados
37×263 Posts |
There are many options for this kind of thing, including "nohup", "session" etc.
Personally I just do something like "mprime -d >> mprime.log < /dev/null 2> /dev/null &" and then exit. This redirects STDIN, STDOUT, and STDERR so there are no file handles attached to the console, and so mprime continues its work without any problems. Last fiddled with by chalsall on 2021-04-22 at 15:11 Reason: s/mprime >/mprime -d >>/; # Good to actually have mprime output something to log... |
|
|
|
|
|
#3 |
|
Dec 2012
The Netherlands
2·23·37 Posts |
In general, the concepts to be aware of here are process groups, sessions and controlling terminals.
Code:
man 7 credentials |
|
|
|
|
|
#4 |
|
"Ed Hall"
Dec 2009
Adirondack Mtns
11×347 Posts |
I have a headless "farm" and I use tmux for terminal type use. There is also a similar option called "screen" that works the same. For my use, I have a GUI session start and use VNC over SSH to log into the GUIs of the machines. The machines are completely headless and use an Xorg dummy setup to make the desktop machines all the same resolution. The GUI and VNC via SSH do tax the machines a little, but I like to have several terminals open in some of the GUIs.
|
|
|
|
|
|
#5 |
|
Jul 2003
wear a mask
2·829 Posts |
I use "disown" - but I'm interested to hear better alternatives.
|
|
|
|
|
|
#6 |
|
"Ed Hall"
Dec 2009
Adirondack Mtns
EE916 Posts |
As the OP and I mentioned, "tmux" will allow you to open a terminal that can be left running when you close the calling terminal. Basically, it works like this:
Open a terminal in the GUI or via SSH, etc. Enter "tmux" (without quotes). Start your program at the tmux prompt. Use CTRL+b, then d (without the CTRL) to exit tmux and leave the called process running. (It will say that it detached.) You can then close your calling terminal. To get back into the session, use "tmux a" in a terminal. To close the tmux session, use "exit." (It will say that it exited.) "screen" works very much the same way and both have a lot more functionality, as described in their docs, such as multiple panes within a session. |
|
|
|
|
|
#7 |
|
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
36·13 Posts |
|
|
|
|
|
|
#8 |
|
Aug 2020
3×5×19 Posts |
Ok thanks, I'll keep using tmux for now.
This mprime -d >> mprime.log < /dev/null 2> /dev/null & seems elegant in that it doesn't rely on any other additional software. I have to admit I don't understand half of the > ... :) |
|
|
|
|
|
#9 | |
|
Sep 2002
Database er0rr
3,739 Posts |
Quote:
>> is append output to < get input from 2 is std error? |
|
|
|
|
|
|
#10 |
|
If I May
"Chris Halsall"
Sep 2002
Barbados
37·263 Posts |
Yup. 2> is STDERR, while > is STDOUT.
I could have also done "2>&1" to redirect STDERR to STDOUT, but I tend not to use that because it is less obvious what's going on, and it uses the "&" symbol which is used later in the command string to throw the process into the background. Last fiddled with by chalsall on 2021-04-23 at 14:33 Reason: Corrected small error. |
|
|
|
|
|
#11 | |
|
Jul 2003
wear a mask
2×829 Posts |
Quote:
|
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is LMH > 100M still alive? | TheMawn | LMH > 100M | 25 | 2016-04-18 16:11 |
| Old pentium bug still alive? | ATH | Soap Box | 8 | 2010-04-14 00:48 |
| How do I logoff without clearing the cookies? | retina | Forum Feedback | 12 | 2006-11-12 07:53 |
| Processes cleanup | JuanTutors | Software | 2 | 2004-07-06 14:34 |
| Windows XP logoff sometimes kills Prime95 | markhl | Software | 8 | 2003-07-07 16:00 |