Skip to content

Instantly share code, notes, and snippets.

@fearless-spider
Created December 30, 2022 18:04
Show Gist options
  • Save fearless-spider/592e99fa7cca924f9a7a24805730a68c to your computer and use it in GitHub Desktop.
Save fearless-spider/592e99fa7cca924f9a7a24805730a68c to your computer and use it in GitHub Desktop.

Revisions

  1. fearless-spider created this gist Dec 30, 2022.
    21 changes: 21 additions & 0 deletions Run python script as systemd service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    You must use a system's de service unit. Locate it in /etc/systemd/system.
    Example:
    /etc/systemd/system/ana-server.service

    [Unit]
    Description=Servidor TCP/IP-Serie para la comunicacion con los sensores del Arduino
    After=syslog.target network.target
    [Service]
    ExecStart=/usr/share/analog/analogArduinoServer.py
    Restart=on-abort
    [Install]
    WantedBy=multi-user.target

    Try first with

    systemctl daemon-reload
    systemctl start ana-server.service

    If it works, do the next to it start at boot:

    systemctl enable ana-server.service