Gentoo Archives: gentoo-user

From: Sid S <r030t1@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Running a program on a headless computer ?
Date: Sun, 28 Sep 2014 22:34:16
Message-Id: CAAD4mYh9k_kwAA_ags62OwERSRM6382oTjxet5XPcVJTjpQT4Q@mail.gmail.com
In Reply to: Re: [gentoo-user] Running a program on a headless computer ? by Todd Goodman
1 I was deciding whether to reply earlier, and my worst fears were realized:
2 you plan to start this automatically with no human intervention.
3
4 Here is a snippet which should do what you want: `nohup my-program >
5 /dev/null 2>&1 &`
6 Screen and tmux will/should work, but at the very least I would suggest
7 wrapping the program with a program of your own where you execute the other
8 and have more and explicit control over the file descriptors.
9
10 The best solution is modifying your programs to work headlessly. This also
11 means you can ensure logging is done properly (you were logging, right?),
12 and not in some ad-hoc fashion like reading all the messages your black box
13 produces and keeping the ones that "look important."
14
15 It's tempting to glue some things together with the shell, but I would
16 avoid reliance on programs which are not yours as much as possible. "Not
17 Invented Here" is often (rightfully) mocked, but this is one of the
18 situations in which it has some relevance.
19
20 On Sun, Sep 28, 2014 at 2:15 PM, Todd Goodman <tsg@×××××××××.net> wrote:
21
22 > * meino.cramer@×××.de <meino.cramer@×××.de> [140928 10:14]:
23 > > Hi,
24 > >
25 > > I want to run programs, which insist on haveing a terminal
26 > > to write their status to and which are writing files which
27 > > their results on a headless computer (beaglebone).
28 > >
29 > > I tried things like
30 > >
31 > > my_program -o file.txt -parameter value > /dev/null &2>&1 &
32 > >
33 > > but this results in a idle copy of this process and a defunct
34 > > child.
35 > >
36 > > The program does not use X11 in any way...
37 > >
38 > > Is there any neat trick to accomplish what I am trying to do here?
39 > >
40 > > Thank you very much in advance for any help!
41 > > Best regards,
42 > > mcc
43 >
44 > You probably want 2>&1 &
45 >
46 >