MIKE LEVIN LPVG SEO

Future-proof your tech-skills with Linux, Python, vim & git as I share with you the most timeless and love-worthy tools in tech — and on staying valuable while machines learn... and beyond.

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: