Thomas' Tech Tips

How to start a detached process inside a screen on boot

8 March 2023 - Thomas Damgaard

These days, I prefer to use
tmux as a terminal multiplexer over screen. However, sometimes I work on systems that only have screen terminal multiplexer available.

Recenly, I had an interactive program that needed to start up at system boot on a Linux system.

I ended up with a quick hack putting the following line into /etc/rc.local:

su - svc_user42 -c "/usr/bin/screen -dmS myapp /opt/myapp/bin/myapp-exe"

This will cause a screen session with the name myapp to be started at boot. Inside the screen session, the command /opt/myapp/bin/myapp-exe will be executed. screen and the myapp-exe will run as the user svc_user42.

Filed under: howto, linux, screen, tips

Back to article list