- Create a service file like
dash_sniffer.service
- Put it in
/lib/systemd/system/
- Reload
systemd
using command:systemctl daemon-reload
- Enable auto start using command:
systemctl enable dash_sniffer.service
Last active
July 8, 2023 04:36
-
-
Save ewenchou/be496b2b73be801fd85267ef5471458c to your computer and use it in GitHub Desktop.
Run Python script as systemd service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Dash Button Sniffer | |
[Service] | |
Type=simple | |
ExecStart=/usr/bin/dash_sniffer.py | |
[Install] | |
WantedBy=multi-user.target |
Well, post the details (service file, script) so others can help.
try:
ExecStart=/usr/bin/python /usr/bin/dash_sniffer.py
Wouldn't it be better to put the file in /etc/systemd/system
, rather than in /lib
? They are both used, but AFAIK the latter is intended for installed packages, rather than administrator additions.
- add
#! /usr/bin/python
to dash_sniffer.py
- chmod 777 dash_sniffer.py
chmod 777 chesus crust
We all had that one guy who pulled a sneaky chmod 777 -R / on the server, right?
We all had that one guy who pulled a sneaky chmod 777 -R / on the server, right?
😂😂😂
We all had that one guy who pulled a sneaky chmod 777 -R / on the server, right?
Tears 🤣🤣🤣
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I followed the same steps for my program lying on GCP but it didn't work.
I was trying to daemonize a python script made for polling a telegram bot.