Better HN
topnewbestaskshowjobs
Log inSign up

_iyrr

1 karma · joined Nov 21, 2022 (4y ago) · 2 submissions

Submissions

comment 10y ago · link · parent

Many ways to accomplish the same thing in Linux, starting with a popen() call. ;) so thanks for pointing out tmux.

Since I use screen fairly often, it had never occurred to me (until fairly recently) that you can rely on it to start with a machine reboot -- and yet have the very familiar interface available to you when you want to intervene. Something to be said about muscle memory.

comment 10y ago · link · parent

Using screen in daemon mode.

    screen -dmS myservice /blah/start.sh
Fit that line somewhere in a properly constructed init.d file and you're good to go. And if you need to execute a safe stop from that program through some interactivity:

    screen -S myservice -X stuff "stop\n"
And voila. It sends a line of text over followed by an enter key. Elegant, useful. You can reattach session to see what's happening at any time. Love me some screen.

When the process exits in that screen session, screen session is closed so that you can rely on screen -list.