summaryrefslogtreecommitdiff
path: root/filesystems/py-prometheus-zfs/files/zfsprom.in
diff options
context:
space:
mode:
Diffstat (limited to 'filesystems/py-prometheus-zfs/files/zfsprom.in')
-rw-r--r--filesystems/py-prometheus-zfs/files/zfsprom.in32
1 files changed, 32 insertions, 0 deletions
diff --git a/filesystems/py-prometheus-zfs/files/zfsprom.in b/filesystems/py-prometheus-zfs/files/zfsprom.in
new file mode 100644
index 000000000000..f4e3fbfc2e49
--- /dev/null
+++ b/filesystems/py-prometheus-zfs/files/zfsprom.in
@@ -0,0 +1,32 @@
+#! /bin/sh -
+#
+# SPDX-License-Identifier: (BSD-2-Clause or Unlicense)
+#
+# Copyright (c) 2021 Mateusz Piotrowski <0mp@FreeBSD.org>
+#
+
+# Add the following lines to rc.conf(5) to configure the zfsprom service:
+#
+# zfsprom_enable (bool): Set to "YES" to enable the service.
+# Default: "NO".
+
+# PROVIDE: zfsprom
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name="zfsprom"
+rcvar="zfsprom_enable"
+
+load_rc_config "${name}"
+
+: "${zfsprom_enable:=NO}"
+
+pidfile="/var/run/${name}.pid"
+procname="%%PREFIX%%/sbin/zfsprom.py"
+command_interpreter="%%PYTHON_CMD%%"
+command="/usr/sbin/daemon"
+command_args="-o /var/log/${name}.log -p ${pidfile} -- ${procname}"
+
+run_rc_command "$1"