From e1c6349ec0d9aa6cb7d1690edf0416ddd3709d8a Mon Sep 17 00:00:00 2001 From: Hendrik Jäger Date: Fri, 1 Jul 2022 22:15:04 +0200 Subject: refactor --- templates/etc/s6-services/irc-services/log/run.epp | 20 ++++++++++++++++++++ templates/etc/s6-services/irc-services/run.epp | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 templates/etc/s6-services/irc-services/log/run.epp create mode 100644 templates/etc/s6-services/irc-services/run.epp (limited to 'templates') diff --git a/templates/etc/s6-services/irc-services/log/run.epp b/templates/etc/s6-services/irc-services/log/run.epp new file mode 100644 index 0000000..60f5e08 --- /dev/null +++ b/templates/etc/s6-services/irc-services/log/run.epp @@ -0,0 +1,20 @@ +<%- | + String $network_name, +| -%> +<% if versioncmp( $facts['os']['release']['major'], '10' ) >= 1 { -%> +#!/usr/bin/execlineb -P +<% } else { -%> +#!/usr/local/bin/execlineb -P +<% } -%> + +define NETWORK_NAME <%= $network_name %> +define SERVICES_LOGDIR /var/log/s6/irc-services-${NETWORK_NAME} +define SERVICES_MAIL_FIFO ${SERVICES_LOGDIR}/mail_fifo + +fdmove -c 2 1 +s6-log + t + s1048576 + S2147483648 + !"background { redirfd -r 0 ${SERVICES_MAIL_FIFO} mail -s \"irc-services log: ${NETWORK_NAME}\" -- root } tee ${SERVICES_MAIL_FIFO}" + "${SERVICES_LOGDIR}/logs" diff --git a/templates/etc/s6-services/irc-services/run.epp b/templates/etc/s6-services/irc-services/run.epp new file mode 100644 index 0000000..ddac6e2 --- /dev/null +++ b/templates/etc/s6-services/irc-services/run.epp @@ -0,0 +1,18 @@ +<%- | + String $network_name, + String $run_user, +| -%> +<% if versioncmp( $facts['os']['release']['major'], '10' ) >= 1 { -%> +#!/usr/bin/execlineb -P +<% } else { -%> +#!/usr/local/bin/execlineb -P +<% } -%> + +define NETWORK_NAME <%= $network_name %> +define RUN_USER <%= $run_user %> +backtick HOME { homeof ${RUN_USER} } +importas -n -u HOME HOME + +fdmove -c 2 1 +s6-setuidgid ${RUN_USER} +${HOME}/rundir/anope/current/bin/services --nofork -- cgit v1.2.3