Autostart a process on GNU screen with systemd

Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. –

systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. –

For our purpose, we are gonna target rtorrent as an example of the auto start using systemd.

To install screen on Ubuntu

 sudo apt-get install screen 

To install screen on ArchLinux

 sudo pacman -S screen

We will need to create a file with our desired name of the service on /etc/systemd/system/

sudo YOUREDITOR /etc/systemd/system/rtorrent@.service

Fill the document with:


ExecStart=/usr/bin/screen -d -m -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 rtorrent


Now that’s just adding the service, we need to enable it so it runs at every boot, notice the ExecStop line, that will kill the rTorrent when the service is going off while ExecStart will start it detached with session name rtorrent.

To enable the service:

sudo systemctl enable rtorrent@.service

As soon as you reboot, rtorrent will be started on a detached screen


If you want reattach the screen:

screen -R rtorrent

To detach:
Press Control + a then d

For further information and examples, check out

One thought on “Autostart a process on GNU screen with systemd”

Leave a Reply