Instantly share code, notes, and snippets.

@ewenchou /
Last active Nov 18, 2018

What would you like to do?
Run Python script as systemd service
  1. Create a service file like dash_sniffer.service
  2. Put it in /lib/systemd/system/
  3. Reload systemd using command: systemctl daemon-reload
  4. Enable auto start using command: systemctl enable dash_sniffer.service
Description=Dash Button Sniffer

This comment has been minimized.

meharcharansahai commented Dec 4, 2017

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.


This comment has been minimized.

skyway22 commented Feb 12, 2018

Well, post the details (service file, script) so others can help.


This comment has been minimized.

tinkerBOY-git commented Feb 22, 2018


ExecStart=/usr/bin/python /usr/bin/


This comment has been minimized.

matthijskooijman commented Aug 22, 2018

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.


This comment has been minimized.

crisscrt commented Aug 29, 2018

  • add

#! /usr/bin/python to

  • chmod 777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment