Check out my first novel, midnight's simulacra!
Screen under systemd
From dankwiki
Sometimes I want to run a process in GNU Screen out of systemd, sometimes out of a user's session. This way, it gets started along with other services, I can monitor its status through standard systemd infrastructure, it gets restarted (or otherwise handled appropriately) on a crash or accidental kill/exit, but I can also come along at any time and monitor its (potentially tty-like) output and send it interactive input.
rtorrent under Screen
Here's my systemd unit for running rtorrent, a full-screen Ncurses application, under Screen in my user session:
# /home/dank/.config/systemd/user/rtorrent.service [Unit] Description=rtorrent screen session After=network.target [Service] Type=simple ExecStart=/usr/bin/screen -L -DmS rtorrent /usr/bin/rtorrent ExecStop=/usr/bin/screen -S rtorrent -X quit NoNewPrivileges=yes ProtectKernelTunables=yes ProtectControlGroups=yes RestrictNamespaces=yes WorkingDirectory=/home/dank/var/lib/rtorrent #RestrictAddressFamilies=AF_INET AF_INET6 #ProtectSystem=yes [Install] WantedBy=default.target