From a7c83d2c0c64635057255894b7ff443d30f94241 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sun, 15 Mar 2015 14:55:53 +0100 Subject: [PATCH] install init.d file for zed --- zfs-debian-pve/rules | 3 +++ zfs-debian-pve/zfsutils.install | 1 + zfs-debian-pve/zfsutils.zed.init | 46 ++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 zfs-debian-pve/zfsutils.zed.init diff --git a/zfs-debian-pve/rules b/zfs-debian-pve/rules index be2eda2..428c4e1 100755 --- a/zfs-debian-pve/rules +++ b/zfs-debian-pve/rules @@ -102,6 +102,9 @@ override_dh_installinit: dh_installinit --name=zfs-share \ --no-restart-on-upgrade --no-start -- defaults 18 00 + @# Install the /etc/init.d/zed script. + dh_installinit --name=zed + override_dh_installudev: dh_installudev --name=zvol --priority=60 diff --git a/zfs-debian-pve/zfsutils.install b/zfs-debian-pve/zfsutils.install index 35a5bad..d24a2f6 100644 --- a/zfs-debian-pve/zfsutils.install +++ b/zfs-debian-pve/zfsutils.install @@ -2,3 +2,4 @@ sbin lib/udev usr/share/man +etc/zfs/zed.d/zed.rc diff --git a/zfs-debian-pve/zfsutils.zed.init b/zfs-debian-pve/zfsutils.zed.init new file mode 100644 index 0000000..ed94e5a --- /dev/null +++ b/zfs-debian-pve/zfsutils.zed.init @@ -0,0 +1,46 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: zed +# Required-Start: $remote_fs $network $syslog zfs +# Required-Stop: $remote_fs $network $syslog zfs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: ZFS Event Daemon +### END INIT INFO + +. /lib/lsb/init-functions + +PATH=/sbin:/bin:/usr/bin:/usr/sbin +DAEMON=/sbin/zed +NAME=zed +DESC="ZFS Event Daemon" +PIDFILE=/var/run/zed.pid + +test -f $DAEMON || exit 0 + +case "$1" in + start) + log_daemon_msg "Starting $DESC" "$NAME" + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON + log_end_msg $? + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + start-stop-daemon --stop --quiet --retry TERM/2/TERM/15/KILL/2 --pidfile $PIDFILE + log_end_msg $? + ;; + restart|reload|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + start-stop-daemon --stop --quiet --retry TERM/2/TERM/15/KILL/2 --pidfile $PIDFILE + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON + log_end_msg $? + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|reload|force-reload}" + exit 1 + ;; +esac + +exit 0