I solved with User inside the service definition and adding the full path to nice and unicorn.
This is my procedure:
which gunicorn
/home/administrator/.local/bin/gunicorn
So I put into wmic_server.service:
[Unit]
Description=WMIC Server
[Service]
User=administrator
Restart=always
# we need the pythonpath to contain the aiowmi directory and the directory where the wmic_server.py is located
# Update the following placeholders before using this file
# AIOWMI_INSTALL_DIR
# WMIC_SERVER_INSTALL_DIR
# WMIC_SERVER_CONFIG
ExecStart=/usr/bin/nice /home/administrator/.local/bin/gunicorn -b 127.0.0.1:2313 –pythonpath /etc/wmic_server,/etc/wmic_server/aiowmi/contrib/wmic_server –threads 1 wmic_server:app
ExecStop=/usr/bin/pkill -f “wmic_server:app”
# Optionally, use these additional settings
# WMIC_SERVER_CONFIG_DIRECTORY defaults to WMIC_SERVER_INSTALL_DIR
# Environment=WMIC_SERVER_CONFIG=WMIC_SERVER_CONFIG_DIRECTORY/wmic_server.yaml
# Environment=WMIC_SERVER_DEBUG=1
[Install]
WantedBy=multi-user.target
And it works.
Furthermore, you have to subsitute the placeholder AIOWMI_INSTALL_DIR and WMIC_SERVER_INSTALL_DIR in the ExecStart, not to use them as variables.
Bye
Mario
-
This reply was modified 2 years, 11 months ago by
bisontim.