-
Notifications
You must be signed in to change notification settings - Fork 184
/
mqttwarn.service
61 lines (58 loc) · 1.57 KB
/
mqttwarn.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# ----------------------------------------------
# systemd unit configuration file for mqttwarn
# ----------------------------------------------
#
# Intro
# -----
# This systemd script assumes you installed mqttwarn
# using `pip install mqttwarn`.
#
# Setup
# -----
#
# Prepare and enable the systemd service::
#
# useradd --create-home --shell /bin/bash mqttwarn
# cp etc/mqttwarn.default /etc/default/mqttwarn
# cp etc/mqttwarn.service /usr/lib/systemd/system/
# cp etc/mqttwarn.logrotate /etc/logrotate.d/mqttwarn
# mkdir /var/log/mqttwarn
# chown mqttwarn:mqttwarn /var/log/mqttwarn
# systemctl enable mqttwarn
#
# Configuration
# -------------
# The configuration file is located at /etc/mqttwarn/mqttwarn.ini,
# but the default setting can be changed by amending the
# MQTTWARNINI environment variable defined in /etc/default/mqttwarn.
#
# Setup example configuration::
#
# mkdir /etc/mqttwarn
# cp mqttwarn.ini.sample /etc/mqttwarn/mqttwarn.ini
#
# Start
# -----
# ::
#
# systemctl start mqttwarn
#
[Unit]
Description=mqttwarn pluggable mqtt notification service
Documentation=https://github.com/mqtt-tools/mqttwarn
After=network.target
[Service]
Type=simple
User=mqttwarn
Group=mqttwarn
LimitNOFILE=65536
Environment='STDOUT=/var/log/mqttwarn/mqttwarn.log'
Environment='STDERR=/var/log/mqttwarn/mqttwarn.log'
EnvironmentFile=/etc/default/mqttwarn
PassEnvironment=MQTTWARNINI
ExecStart=/bin/sh -c 'exec /usr/local/bin/mqttwarn ${MQTTWARN_OPTIONS} >>${STDOUT} 2>>${STDERR}'
KillMode=control-group
Restart=on-failure
[Install]
WantedBy=multi-user.target
Alias=mqttwarn.service