From 5987a8836cf576b70ef9db01fed72938eba2bbff Mon Sep 17 00:00:00 2001 From: hasufell Date: Tue, 15 Sep 2015 16:35:15 +0200 Subject: [PATCH] saving uncommitted changes in /etc prior to emerge run --- conf.d/znc | 24 ++++++++++++++++++++++++ init.d/znc | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 conf.d/znc create mode 100755 init.d/znc diff --git a/conf.d/znc b/conf.d/znc new file mode 100644 index 0000000..b78e053 --- /dev/null +++ b/conf.d/znc @@ -0,0 +1,24 @@ +# /etc/conf.d/znc + +# Location of the znc configuration folder +ZNC_DATADIR="/var/lib/znc" + +# User to run znc as +ZNC_USER="znc" + +# Group to run znc as +ZNC_GROUP="znc" + +# PID file +ZNC_PIDFILE="/run/znc/znc.pid" + +# You can use this configuration option to pass additional options to the +# start-stop-daemon, see start-stop-daemon(8) for more details. +# Per default we wait 1000ms after we have started the service to ensure +# that the daemon is really up and running. +ZNC_SSDARGS="--wait 1000" + +# The termination timeout (start-stop-daemon parameter "retry") ensures +# that the service will be terminated within a given time (30 + 5 seconds +# per default) when you are stopping the service. +ZNC_TERMTIMEOUT="TERM/30/KILL/5" diff --git a/init.d/znc b/init.d/znc new file mode 100755 index 0000000..a726ba1 --- /dev/null +++ b/init.d/znc @@ -0,0 +1,40 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +extra_commands="config" +extra_started_commands="reload save" +command="/usr/bin/znc" +command_args="--datadir \"${ZNC_DATADIR}\"" +pidfile="${ZNC_PIDFILE:-/run/znc/znc.pid}" +user=${ZNC_USER:-znc} +group=${ZNC_GROUP:-znc} +start_stop_daemon_args="--chdir \"${ZNC_DATADIR}\" --user ${user} --group ${group} ${ZNC_SSDARGS}" +retry="${ZNC_TERMTIMEOUT}" + +required_dirs="${ZNC_DATADIR}" + +depend() { + use dns logger +} + +start_pre() { + checkpath -d -m 0770 -o ${user}:${group} "$(dirname ${pidfile})" +} + +stop_post() { + rm "${pidfile}" +} + +reload() { + ebegin "Reloading ZNC Configuration File from Disk" + start-stop-daemon --signal SIGHUP --pidfile "${pidfile}" + eend $? +} + +save() { + ebegin "Saving ZNC Configuration File to Disk" + start-stop-daemon --signal SIGUSR1 --pidfile "${pidfile}" + eend $? +}