ports/sysutils/zrepl/files/zrepl.in
Ben Woods aa29472b28 sysutils/zrepl: Update to 0.1.1
Changes this release:
  https://zrepl.github.io/v0.1.1/changelog.html

WARNING - BREAKING CHANGES WITH THE ZREPL 0.1.X RELEASE:
There are a number of breaking changes this release. To ensure zrepl
continues to function correctly, ensure you read the changelog, and then
perform the following on both sides of the replication:
- Stop the zrepl service:    # service zrepl stop
- Upgrade the zrepl package: # pkg upgrade zrepl
- Modify the zrepl config:   # vi /usr/local/etc/zrepl/zrepl.yml
- Check the configuration:   # service zrepl configtest
- Start the zrepl service:   # service zrepl start
- Monitor the zrepl service: # zrepl status

DANGER - SNAPSHOT PRUNING REQUIRES EXPLICIT KEEP RULES:
For any ZFS snapshot that you want to keep, at least one rule must match. This
is different from previous releases where pruning only affected snapshots with
the configured snapshotting prefix. Make sure that snapshots to be kept or
ignored by zrepl are covered, e.g. by using the regex keep rule.
This also applies to snapshots taken by means other than zrepl (e.g. manually).

PR:		237667
Submitted by:	Michael Zhilin (mizhka@gmail.com)
Differential Revision:	https://reviews.freebsd.org/D20095
2019-06-04 14:14:23 +00:00

81 lines
2.1 KiB
Bash

#!/bin/sh
# $FreeBSD$
#
# PROVIDE: zrepl
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# zrepl_enable (bool): Set to YES to enable the zrepl service.
# Default: NO
# zrepl_config (str): File containing zrepl configuration details.
# Default: %%PREFIX%%/etc/zrepl/zrepl.yml
# zrepl_user (str): The user account used to run the zrepl daemon.
# Do not specifically set this to an empty string as this
# will cause the daemon to run as root.
# Default: root
# zrepl_group (str): The group account used to run the zrepl daemon.
# Do not specifically set this to an empty string as this
# will cause the daemon to run with group wheel.
# Default: wheel
# zrepl_flags (str): Extra flags passed to zrepl
# Default: ""
# zrepl_facility (str): Syslog facility to use
# Default: local0
# zrepl_priority (str): Syslog priority to use
# Default: alert
. /etc/rc.subr
name=zrepl
rcvar=${name}_enable
load_rc_config $name
: ${zrepl_enable:="NO"}
: ${zrepl_config:="%%PREFIX%%/etc/zrepl/zrepl.yml"}
: ${zrepl_user:="root"}
: ${zrepl_group:="wheel"}
: ${zrepl_flags:=""}
: ${zrepl_facility:="local0"}
: ${zrepl_priority:="alert"}
: ${zrepl_options:="${zrepl_flags} --config ${zrepl_config}"}
pidfile="/var/run/zrepl/daemon.pid"
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/zrepl"
command_args="-p ${pidfile} %%DAEMON_LOGGING%% ${procname} ${zrepl_options} daemon"
start_precmd="zrepl_precmd"
stop_postcmd="zrepl_postcmd"
restart_precmd="zrepl_checkconfig"
configtest_cmd="zrepl_checkconfig"
extra_commands="configtest"
zrepl_precmd()
{
if [ ! -d "/var/run/zrepl/stdinserver" ]; then
install -d -g ${zrepl_group} -o ${zrepl_user} -m 0700 -- "/var/run/zrepl";
install -d -g ${zrepl_group} -o ${zrepl_user} -m 0700 -- "/var/run/zrepl/stdinserver";
fi
if [ ! -e "${pidfile}" ]; then
install -g ${zrepl_group} -o ${zrepl_user} -- /dev/null "${pidfile}";
fi
zrepl_checkconfig
}
zrepl_postcmd()
{
rm -f -- "${pidfile}"
}
zrepl_checkconfig()
{
echo "Performing sanity check on zrepl configuration:"
eval ${procname} ${zrepl_options} configcheck
}
run_rc_command "$1"