Skip to content

Instantly share code, notes, and snippets.

@Sllayan
Created September 9, 2024 13:46
Show Gist options
  • Select an option

  • Save Sllayan/0527e8dc73815def8b8a6b1884b400f5 to your computer and use it in GitHub Desktop.

Select an option

Save Sllayan/0527e8dc73815def8b8a6b1884b400f5 to your computer and use it in GitHub Desktop.

Linux

Run as a linux service in linux system

How we can make a service in linux system

You have to make a file in /etc/systemd/system/ with .service format.

format of content into this :

[Unit]
Description={{description of your service}}
After=network.target

[Service]
User=root
Group=www-data
WorkingDirectory={{directory of your service}}
ExecStart={{the needed command to start }}

[Install]
WantedBy=multi-user.target

You can also configure many things according to your needs.

[Unit]
Description=orderlogsback
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/var/www/orderlogsback
ExecStart=/var/www/orderlogsback/.orderlogsback/bin/python3.10 /var/www/orderlogsback/server.py
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment