From f54855d32da5c9c3302ea22e75d1666d65d15a80 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 22 Jan 2017 20:59:26 -0800 Subject: app-admin/serf: add package Package-Manager: Portage-2.3.3, Repoman-2.3.1 --- app-admin/serf/files/serf.confd | 7 +++++++ app-admin/serf/files/serf.initd | 39 ++++++++++++++++++++++++++++++++++++ app-admin/serf/files/serf.logrotated | 8 ++++++++ app-admin/serf/files/serf.service | 14 +++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 app-admin/serf/files/serf.confd create mode 100644 app-admin/serf/files/serf.initd create mode 100644 app-admin/serf/files/serf.logrotated create mode 100644 app-admin/serf/files/serf.service (limited to 'app-admin/serf/files') diff --git a/app-admin/serf/files/serf.confd b/app-admin/serf/files/serf.confd new file mode 100644 index 000000000000..f5aeaeddf7e7 --- /dev/null +++ b/app-admin/serf/files/serf.confd @@ -0,0 +1,7 @@ +# you can change the init script behavior by setting those parameters +# - group (default: serf) +# - pidfile (default: /run/serf/serf.pid) +# - user (default: serf) + +# extra arguments for the serf agent +command_args="-config-dir=/etc/serf.d" diff --git a/app-admin/serf/files/serf.initd b/app-admin/serf/files/serf.initd new file mode 100644 index 000000000000..ce69aea1d627 --- /dev/null +++ b/app-admin/serf/files/serf.initd @@ -0,0 +1,39 @@ +#!/sbin/openrc-run +# Copyright 2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +description="serf agent" +extra_started_commands="reload" +group=${group:-${RC_SVCNAME}} +pidfile=${pidfile:-"/run/${RC_SVCNAME}/${RC_SVCNAME}.pid"} +user=${user:-${RC_SVCNAME}} + +command="/usr/bin/${RC_SVCNAME}" +command_args="agent -config-dir=/etc/serf.d ${command_args}" +command_background="true" +start_stop_daemon_args="--user ${user} --group ${group} \ + --stdout /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log \ + --stderr /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log" + +depend() { + need net + after net +} + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + ${command} reload + eend $? +} + +start_pre() { + checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}" +} + +stop() { + # SIGINT is required for graceful shutdown of serf agent + ebegin "Stopping ${RC_SVCNAME}" + start-stop-daemon --stop --signal SIGINT --pidfile "${pidfile}" + eend $? +} diff --git a/app-admin/serf/files/serf.logrotated b/app-admin/serf/files/serf.logrotated new file mode 100644 index 000000000000..b4c778ab29a7 --- /dev/null +++ b/app-admin/serf/files/serf.logrotated @@ -0,0 +1,8 @@ +/var/log/serf/serf.log { + su serf serf + missingok + size 5M + rotate 3 + compress + copytruncate +} diff --git a/app-admin/serf/files/serf.service b/app-admin/serf/files/serf.service new file mode 100644 index 000000000000..f2d390fe8222 --- /dev/null +++ b/app-admin/serf/files/serf.service @@ -0,0 +1,14 @@ +[Unit] +Description=serf agent +Requires=network-online.target +After=network-online.target + +[Service] +User=serf +Environment=SERF_AGENT_OPTS="-config-dir=/etc/serf.d" +ExecStart=/usr/bin/serf agent $SERF_AGENT_OPTS +Restart=on-failure +KillSignal=SIGINT + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3-65-gdbad