From 5409520c94338123e9edb733603cc3555f589cc8 Mon Sep 17 00:00:00 2001 From: Phillip Smith Date: Sun, 18 Mar 2018 20:19:07 +1100 Subject: [PATCH] initial commit of systemd unit and bsd rc script --- fscanary.rc | 23 +++++++++++++++++++++++ fscanary.service | 22 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 fscanary.rc create mode 100644 fscanary.service diff --git a/fscanary.rc b/fscanary.rc new file mode 100644 index 0000000..82445b4 --- /dev/null +++ b/fscanary.rc @@ -0,0 +1,23 @@ +#!/bin/sh +# +# PROVIDE: fscanary +# REQUIRE: syslog +# KEYWORD: + +. /etc/rc.subr + +name="fscanary" +rcvar="fscanary_enable" +command="/usr/local/bin/fscanary" + +fscanary_user="root" +fscanary_config="/usr/local/etc/fscanary.conf" +fscanary_syslog_facility="daemon" +fscanary_syslog_priority="info" + +start_cmd="/usr/sbin/daemon -l $fscanary_syslog_facility -s $fscanary_syslog_priority -T $name -t $name -u $fscanary_user $command -config $fscanary_config" + +load_rc_config $name +: ${fscanary_enable:=no} + +run_rc_command "$1" diff --git a/fscanary.service b/fscanary.service new file mode 100644 index 0000000..fddf860 --- /dev/null +++ b/fscanary.service @@ -0,0 +1,22 @@ +[Unit] +Description=File System Canary Daemon +After=network.target + +[Service] +Type=simple +User=root +Group=root +Restart=on-failure +RestartSec=3 +StartLimitIntervalSec=60 +ExecStart=/usr/local/bin/fscanary +# log stdin/stdout to syslog/journald +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=fscanary +# you may wish to give fscanary a higher nice priority to make it schedule +# better with other system processes +#Nice=5 + +[Install] +WantedBy=default.target