1 |
On Sun, 28 September 2014, at 5:08 pm, meino.cramer@×××.de wrote: |
2 |
>>> ... |
3 |
>>> I want to run programs, which insist on haveing a terminal |
4 |
>>> to write their status to and which are writing files which |
5 |
>>> their results on a headless computer (beaglebone). |
6 |
>> |
7 |
>> I would suggest to run the program in a screen session, you can disconnect |
8 |
>> frim the session and reconnect later. |
9 |
> |
10 |
> ...the headless device will be booted and the programm will be startet |
11 |
> via a kind of autostart script. No human intervention is |
12 |
> wanted/possible... |
13 |
|
14 |
It's certainly possible to write such scripts to start automatically. |
15 |
|
16 |
E.G. from tmux's manpage: |
17 |
|
18 |
tmux new-session -d 'vi /etc/passwd' \; split-window -d \; attach |
19 |
|
20 |
Tested here: |
21 |
|
22 |
#!/bin/bash |
23 |
tmux new-session -n meino -d |
24 |
tmux send -t meino ls ENTER |
25 |
|
26 |
You would be able to access this: |
27 |
|
28 |
$ tmux list-w |
29 |
0: meino* (1 panes) [80x39] [layout c85d,80x39,0,0,0] @0 (active) |
30 |
$ tmux a |
31 |
|
32 |
|
33 |
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. |
34 |
|
35 |
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. |
36 |
|
37 |
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. |
38 |
|
39 |
I referred to this page: http://serverfault.com/questions/339390/run-command-in-detached-tmux-session |
40 |
It's a top google hit for "run command in tmux" |
41 |
|
42 |
Stroller. |