[pve-devel] [PATCH lxcfs 1/2] Make lxcfs.service reloadable, reload in postinst

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Feb 17 13:56:45 CET 2016


Also don't restart on upgrades
---
 debian/lxcfs.postinst | 20 ++++++++++++++++++++
 debian/lxcfs.service  |  5 +++--
 debian/rules          |  6 ++++++
 3 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 debian/lxcfs.postinst

diff --git a/debian/lxcfs.postinst b/debian/lxcfs.postinst
new file mode 100644
index 0000000..42dd1ec
--- /dev/null
+++ b/debian/lxcfs.postinst
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+  configure)
+    # Check for reload support in lxcfs
+    if [ -n "$2" ] && dpkg --compare-versions "$2" ge 2.0.0-pve1; then
+      # Check for running lxfs
+      if [ -f /run/lxcfs.pid ]; then
+        kill -USR1 `cat /run/lxcfs.pid`
+      fi
+    fi
+  ;;
+
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/lxcfs.service b/debian/lxcfs.service
index c0f2998..8c2f600 100644
--- a/debian/lxcfs.service
+++ b/debian/lxcfs.service
@@ -5,9 +5,10 @@ Before=lxc.service
 
 [Service]
 ExecStart=/usr/bin/lxcfs /var/lib/lxcfs/
-KillMode=none
+KillMode=process
 Restart=on-failure
-ExecStop=/bin/fusermount -u /var/lib/lxcfs
+ExecReload=/bin/kill -USR1 $MAINPID
+ExecStopPost=-/bin/fusermount -u /var/lib/lxcfs
 
 [Install]
 WantedBy=multi-user.target
diff --git a/debian/rules b/debian/rules
index de2fd6e..6911ba9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,3 +11,9 @@ override_dh_strip:
 
 override_dh_auto_install:
 	dh_auto_install --destdir=debian/lxcfs
+
+override_dh_installinit:
+	dh_installinit -p lxcfs --no-restart-on-upgrade
+
+override_dh_systemd_start:
+	dh_systemd_start -p lxcfs --no-restart-on-upgrade lxcfs.service
-- 
2.1.4





More information about the pve-devel mailing list