From 5da7a5eb4564e4075a0b9d40b3649f4191c5ef81 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Tue, 16 Aug 2016 18:20:11 -0400 Subject: [PATCH 1/5] Don't automatically restart the systemd service This isn't the normal way that systemd service files are written, and lots of admins will probably be surprised to find that this is happening. Therefore, remove it from the default configuration. This is especially relevant given that the default ExecStart command produces a help message, which causes systemd to mark the unit as failed. This causes an infinite restart loop on default installs. --- etc/ot-recorder.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/etc/ot-recorder.service b/etc/ot-recorder.service index ca10232..010cbd0 100644 --- a/etc/ot-recorder.service +++ b/etc/ot-recorder.service @@ -19,8 +19,6 @@ WorkingDirectory=/ # deprecated: use config file # Environment='OTR_USER=xxx' ExecStart=/usr/sbin/ot-recorder -Restart=always -RestartSec=60 StandardOutput=null StandardError=syslog SyslogIdentifier=ot-recorder From d79692136cc1149e703368b9a9266dce37d0510a Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Tue, 16 Aug 2016 18:25:06 -0400 Subject: [PATCH 2/5] Don't send stdout and stderr to custom locations If the user is on systemd it's reasonable to assume that they are also using journald. This is the default on most (all?) systemd systems and any admin who configures their system to send things to syslog instead of journald can deal with one more thing that needs to be changed. Therefore, optimize for the majority and send logs to the default journald. Additionally, don't send stdout to /dev/null because this isn't the norm with systemd; stdout can provide valuable debugging information; and journald provides facilities for filtering out stdout in log output. --- etc/ot-recorder.service | 3 --- 1 file changed, 3 deletions(-) diff --git a/etc/ot-recorder.service b/etc/ot-recorder.service index 010cbd0..d4de7ef 100644 --- a/etc/ot-recorder.service +++ b/etc/ot-recorder.service @@ -19,9 +19,6 @@ WorkingDirectory=/ # deprecated: use config file # Environment='OTR_USER=xxx' ExecStart=/usr/sbin/ot-recorder -StandardOutput=null -StandardError=syslog -SyslogIdentifier=ot-recorder [Install] WantedBy=multi-user.target From 997573828b8782e6acf154b9fd48752bdef64dc5 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Tue, 16 Aug 2016 18:34:21 -0400 Subject: [PATCH 3/5] Remove deprecated syntax in systemd unit file No point showing this in new installs. --- etc/ot-recorder.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/etc/ot-recorder.service b/etc/ot-recorder.service index d4de7ef..75b94f3 100644 --- a/etc/ot-recorder.service +++ b/etc/ot-recorder.service @@ -16,8 +16,6 @@ Description=OwnTracks Recorder Type=simple User=owntracks WorkingDirectory=/ -# deprecated: use config file -# Environment='OTR_USER=xxx' ExecStart=/usr/sbin/ot-recorder [Install] From 579f45308773811e1a935871778d3762bea4e11a Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Tue, 16 Aug 2016 18:37:03 -0400 Subject: [PATCH 4/5] Pass the standard MQTT topic in the systemd unit Add the standard OwnTracks MQTT topic as the first argument to `ot-recorder` in the service file. This provides a usable experience out of the box (otherwise the service file will fail with a help message). --- etc/ot-recorder.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/ot-recorder.service b/etc/ot-recorder.service index 75b94f3..bb93a43 100644 --- a/etc/ot-recorder.service +++ b/etc/ot-recorder.service @@ -16,7 +16,7 @@ Description=OwnTracks Recorder Type=simple User=owntracks WorkingDirectory=/ -ExecStart=/usr/sbin/ot-recorder +ExecStart=/usr/sbin/ot-recorder 'owntracks/+/+' [Install] WantedBy=multi-user.target From b128eceb4719098bce1a2938687ead95d0610439 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Tue, 16 Aug 2016 18:43:08 -0400 Subject: [PATCH 5/5] Remove usage instructions in the systemd unit This isn't really a great place for these, and they're not very complete anyway. Better to put this in the proper docs, where it'll be obvious and complete. --- etc/ot-recorder.service | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/etc/ot-recorder.service b/etc/ot-recorder.service index bb93a43..7728262 100644 --- a/etc/ot-recorder.service +++ b/etc/ot-recorder.service @@ -1,14 +1,5 @@ # /etc/systemd/system/ot-recorder.service -# systemctl enable ot-recorder -# systemctl start ot-recorder -# systemctl --system daemon-reload -# journalctl -f -# -# Centos -# install -m644 /usr/share/doc/ot-recorder/ot-recorder.service \ -# /usr/lib/systemd/system/ot-recorder.service -# systemctl --system daemon-reload -# + [Unit] Description=OwnTracks Recorder