Gentoo Archives: gentoo-user

From: "Jc García" <jyo.garcia@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Running a program on a headless computer ?
Date: Sun, 28 Sep 2014 17:07:35
Message-Id: CAGQH77e1UDOgNOZntXLAmUajjK_3T6GAHMhRbC9WFoDd42V3=A@mail.gmail.com
In Reply to: Re: [gentoo-user] Running a program on a headless computer ? by meino.cramer@gmx.de
1 2014-09-28 10:08 GMT-06:00 <meino.cramer@×××.de>:
2 >
3 > Randolph Maaßen <r.maassen60@×××××.com> [14-09-28 16:24]:
4 >> On Sep 28, 2014 4:14 PM, <meino.cramer@×××.de> wrote:
5 >> >
6 >> > Hi,
7 >> >
8 >> > I want to run programs, which insist on haveing a terminal
9 >> > to write their status to and which are writing files which
10 >> > their results on a headless computer (beaglebone).
11 >> >
12 >> > I tried things like
13 >> >
14 >> > my_program -o file.txt -parameter value > /dev/null &2>&1 &
15 >> >
16 >> > but this results in a idle copy of this process and a defunct
17 >> > child.
18 >> >
19 >> > The program does not use X11 in any way...
20 >> >
21 >> > Is there any neat trick to accomplish what I am trying to do here?
22 >> >
23 >> > Thank you very much in advance for any help!
24 >> > Best regards,
25 >> > mcc
26 >> >
27 >> >
28 >> >
29 >>
30 >> I would suggest to run the program in a screen session, you can disconnect
31 >> frim the session and reconnect later.
32 >>
33 >> http://www.gnu.org/software/screen/
34 >>
35 >> --
36 >> Best regards
37 >> Randolph Maaßen
38 >
39 > Hi Randolph,
40 >
41 > ...the headless device will be booted and the programm will be startet
42 > via a kind of autostart script. No human intervention is
43 > wanted/possible...
44 >
45
46 You can use ">&-" in the script to run the program with stdout closed
47 by default, but this might result in an error if the program relies on
48 stdout open example:
49 ---
50 $ echo "Hello" >&-
51 bash: echo: write error: Bad file descriptor
52 ---
53 but if I do this(stdout and stderr closed):
54 --
55 $ echo "Hello" 2>&- >&-
56 --
57 nothing is printed
58 but
59 --
60 $ echo $?
61 1
62 --
63 However if I try to run an application that uses X it starts normally.
64 more info on this stuff on [1]
65 in page 15 it's kind of explained the case of programs running with ">&-"
66 https://www.gnu.org/ghm/2011/paris/slides/jim-meyering-goodbye-world.pdf
67
68 > Best regards,
69 > mcc
70 >
71 >
72 >