Mike Levin SEO

Future-proof your technology-skills with Linux, Python, vim & git... and me!

← You Need a Personal Server In Your Life & The Time is Nigh
Cast a Homunculus Majordomo to Help Run Your Life →

How to Use the Screen Command for Linux Service

by Mike Levin

Friday, October 28, 2022

It’s time to make the service. I’ve learned a few things.

https://www.gnu.org/software/screen/manual/html_node/Socket-Directory.html

Here’s the file that goes into /etc/systemd/system/

[Unit]
Description=Scheduling

[Service]
Type=forking
Restart=always
RestartSec=5
User=ubuntu
Group=ubuntu
Environment="SCREENDIR=/home/ubuntu/.screen"
WorkingDirectory=/home/ubuntu/repos/pulse/
ExecStart=/usr/bin/screen -dmS pulse /home/ubuntu/py310/bin/python3.10 /home/ubuntu/repos/pulse/pulse.py

[Install]
WantedBy=multi-user.target

And here’s the video: