Hi Felix,
Thanks for the quick reply.
Felix Geyer <fge...@debian.org> writes:
> vnstatd is now run as user vnstat and the command arguments have
> changed. The service file also needs to make sure that /run/vnstat
> is created before running vnstatd and that it is owned by vnstat:vnstat.
Find attached a fresh patch against vnstat’s packaging git HEAD which
takes care of all of this :).
I tested this on my machine and it works fine:
x200 ~ $ sudo systemctl status vnstat.service
vnstat.service - Network traffic monitor
Loaded: loaded (/lib/systemd/system/vnstat.service; enabled)
Active: active (running) since Tue 2013-07-09 23:16:32 CEST; 34s ago
Main PID: 5287 (vnstatd)
CGroup: name=systemd:/system/vnstat.service
└─5287 /usr/sbin/vnstatd -n
Jul 09 23:16:32 x200 systemd[1]: Starting Network traffic monitor...
Jul 09 23:16:32 x200 systemd[1]: Started Network traffic monitor.
x200 ~ $ sudo systemctl reload vnstat.service
x200 ~ $ sudo systemctl status vnstat.service
vnstat.service - Network traffic monitor
Loaded: loaded (/lib/systemd/system/vnstat.service; enabled)
Active: active (running) since Tue 2013-07-09 23:16:32 CEST; 59s ago
Process: 5397 ExecReload=/bin/kill -HUP $MAINPID (code=exited,
status=0/SUCCESS)
Main PID: 5287 (vnstatd)
CGroup: name=systemd:/system/vnstat.service
└─5287 /usr/sbin/vnstatd -n
Jul 09 23:16:32 x200 systemd[1]: Starting Network traffic monitor...
Jul 09 23:16:32 x200 systemd[1]: Started Network traffic monitor.
Jul 09 23:17:27 x200 systemd[1]: Reloading Network traffic monitor.
Jul 09 23:17:27 x200 systemd[1]: Reloaded Network traffic monitor.
x200 ~ $ ps auxf | grep 5287
michael 5417 0.0 0.0 10000 640 pts/1 S+ 23:17 0:00
\_ grep 5287
vnstat 5287 0.0 0.0 7336 804 ? Ss 23:16 0:00
/usr/sbin/vnstatd -n
--
Best regards,
Michael
>From c717d1cdd5fa0a074292fb500615c652e14ec272 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <mich...@stapelberg.de>
Date: Tue, 9 Jul 2013 23:14:12 +0200
Subject: [PATCH] add systemd service file, use dh-systemd
---
debian/control | 2 +-
debian/rules | 2 +-
debian/vnstat.service | 10 ++++++++++
debian/vnstat.tmpfile | 1 +
4 files changed, 13 insertions(+), 2 deletions(-)
create mode 100644 debian/vnstat.service
create mode 100644 debian/vnstat.tmpfile
diff --git a/debian/control b/debian/control
index 16fc2e6..28e6d43 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: vnstat
Section: net
Priority: optional
Maintainer: Felix Geyer <fge...@debian.org>
-Build-Depends: debhelper (>= 9), libgd-dev
+Build-Depends: debhelper (>= 9), libgd-dev, dh-systemd (>= 1.4)
Standards-Version: 3.9.4
Homepage: http://humdi.net/vnstat/
Vcs-Git: git://anonscm.debian.org/collab-maint/vnstat.git
diff --git a/debian/rules b/debian/rules
index b37d0e0..0838c75 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,7 +1,7 @@
#!/usr/bin/make -f
%:
- dh $@ --parallel
+ dh $@ --parallel --with=systemd
override_dh_auto_build:
dh_auto_build -- all
diff --git a/debian/vnstat.service b/debian/vnstat.service
new file mode 100644
index 0000000..b90a077
--- /dev/null
+++ b/debian/vnstat.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Network traffic monitor
+
+[Service]
+User=vnstat
+ExecStart=/usr/sbin/vnstatd -n
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/vnstat.tmpfile b/debian/vnstat.tmpfile
new file mode 100644
index 0000000..f91fe11
--- /dev/null
+++ b/debian/vnstat.tmpfile
@@ -0,0 +1 @@
+d /run/vnstat 0755 vnstat vnstat - -
--
1.7.10.4