Gentoo Archives: gentoo-user

From: meino.cramer@×××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Running a program on a headless computer ?
Date: Sun, 28 Sep 2014 17:06:42
Message-Id: 20140928170631.GB17837@solfire
In Reply to: Re: [gentoo-user] Running a program on a headless computer ? by Stroller
1 Stroller <stroller@××××××××××××××××××.uk> [14-09-28 18:52]:
2 >
3 > On Sun, 28 September 2014, at 5:08 pm, meino.cramer@×××.de wrote:
4 > >>> ...
5 > >>> I want to run programs, which insist on haveing a terminal
6 > >>> to write their status to and which are writing files which
7 > >>> their results on a headless computer (beaglebone).
8 > >>
9 > >> I would suggest to run the program in a screen session, you can disconnect
10 > >> frim the session and reconnect later.
11 > >
12 > > ...the headless device will be booted and the programm will be startet
13 > > via a kind of autostart script. No human intervention is
14 > > wanted/possible...
15 >
16 > It's certainly possible to write such scripts to start automatically.
17 >
18 > E.G. from tmux's manpage:
19 >
20 > tmux new-session -d 'vi /etc/passwd' \; split-window -d \; attach
21 >
22 > Tested here:
23 >
24 > #!/bin/bash
25 > tmux new-session -n meino -d
26 > tmux send -t meino ls ENTER
27 >
28 > You would be able to access this:
29 >
30 > $ tmux list-w
31 > 0: meino* (1 panes) [80x39] [layout c85d,80x39,0,0,0] @0 (active)
32 > $ tmux a
33 >
34 >
35 > I'm not saying that a terminal multiplexer is the best way to solve your problem - I don't understand why the output of your program is not directable to a text file - but it's definitely possible to script the process of running a program in a terminal multiplexer window or session.
36 >
37 > You could write a script to see if a specific named session exists, and start one if it doesn't. You could then call this every 5 minutes in cron.
38 >
39 > Note that, in the example above I've named the window "meino" - I think you might be advised to name both window and session. You can attach sessions by name.
40 >
41 > I referred to this page: http://serverfault.com/questions/339390/run-command-in-detached-tmux-session
42 > It's a top google hit for "run command in tmux"
43 >
44 > Stroller.
45 >
46
47 I tried to redirect the output, which technically is comparable with what
48 can be seen by running "top". The result as mentioned is a somewhat
49 locked process and its zombie child.
50
51 Starting of whatever will accomplish what I am trying to do is already
52 implemented (somewhow uglyish...;) and works...beside of the
53 sideeffect that the program goes zombie.
54
55 I definately will try the screen or tmux version (or both ;) ) !
56
57 Thank you very much for all help !
58 Best regards,
59 mcc