On Sun, 28 September 2014, at 5:08 pm, [email protected] wrote:
>>> ...
>>> I want to run programs, which insist on haveing a terminal
>>> to write their status to and which are writing files which
>>> their results on a headless computer (beaglebone).
>> 
>> I would suggest to run the program in a screen session, you can disconnect
>> frim the session and reconnect later.
> 
> ...the headless device will be booted and the programm will be startet
> via a kind of autostart script. No human intervention is
> wanted/possible...

It's certainly possible to write such scripts to start automatically. 

E.G. from tmux's manpage: 

   tmux new-session -d 'vi /etc/passwd' \; split-window -d \; attach

Tested here:

   #!/bin/bash
   tmux new-session -n meino -d
   tmux send -t meino ls ENTER

You would be able to access this:

   $ tmux list-w
   0: meino* (1 panes) [80x39] [layout c85d,80x39,0,0,0] @0 (active)
   $ tmux a


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.

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.

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.

I referred to this page: 
http://serverfault.com/questions/339390/run-command-in-detached-tmux-session
It's a top google hit for "run command in tmux"

Stroller.




Reply via email to