Skip to content

Instantly share code, notes, and snippets.

@peeyushsrj
Created December 18, 2019 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peeyushsrj/7153a17a3ef6387c80c2f0c103c4137a to your computer and use it in GitHub Desktop.
Save peeyushsrj/7153a17a3ef6387c80c2f0c103c4137a to your computer and use it in GitHub Desktop.
Start a service bash
sudo nano /lib/systemd/system/sample.service
Add in the following text :
[Unit]
Description=My Sample Service
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python /home/pi/sample.py
[Install]
WantedBy=multi-user.target
sudo chmod 644 /lib/systemd/system/sample.service
sudo systemctl daemon-reload
sudo systemctl enable sample.service
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment