-
Notifications
You must be signed in to change notification settings - Fork 34
/
mlapi.service
45 lines (36 loc) · 1.25 KB
/
mlapi.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# This is a systemd startup file if you are on a system that
# supports systemd and you want mlapi to work as an always
# on service
# Please make sure you run mlapi manually first
# to create a user/password for access and then enable
# this service
# To make this persistent
# sudo cp mlapi.service /etc/systemd/system
# sudo chmod 644 /etc/systemd/system/mlapi.service
# sudo systemctl enable mlapi.service
# To start,
# sudo systemctl start mlapi
[Unit]
Description=Machine Learning API service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=5
# We need this to get logs correctly
Environment=PYTHONUNBUFFERED=1
# change this
WorkingDirectory=/var/lib/zmeventnotification/mlapi
# Change to your username
User=www-data
#Change paths if needed
ExecStart=/var/lib/zmeventnotification/mlapi/mlapi.py -c ./mlapiconfig.ini
ExecStartPost=+/bin/sh -c 'umask 022; pgrep mlapi.py > /var/run/mlapi.pid'
# Note that if you enable use_zm_logs=yes in mlapiconfig.ini
# you can comment these out. If you enable use_zm_logs, the logs
# will be written in ZM log format to <path to zm logs>/zm_mlapi.log
StandardOutput=file:/var/log/zm/mlapi.log
StandardError=file:/var/log/zm/mlapi_error.log
[Install]
WantedBy=multi-user.target