From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- net-mail/fetchmail/files/fetchmail.initd | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 net-mail/fetchmail/files/fetchmail.initd (limited to 'net-mail/fetchmail/files/fetchmail.initd') diff --git a/net-mail/fetchmail/files/fetchmail.initd b/net-mail/fetchmail/files/fetchmail.initd new file mode 100644 index 000000000000..f967e5aed552 --- /dev/null +++ b/net-mail/fetchmail/files/fetchmail.initd @@ -0,0 +1,44 @@ +#!/sbin/openrc-run + +piddir=${pid_dir:-/var/run/fetchmail} +pid_file=${piddir}/${RC_SVCNAME}.pid +rcfile=/etc/${RC_SVCNAME}rc + +depend() { + need net + use mta +} + +checkconfig() { + if [ ! -f ${rcfile} ]; then + eerror "Configuration file ${rcfile} not found" + return 1 + fi + local fetchmail_instance + fetchmail_instance=${RC_SVCNAME##*.} + if [ -n "${fetchmail_instance}" -a "${RC_SVCNAME}" != "fetchmail" ]; then + fidfile=/var/lib/fetchmail/.fetchids.${RC_SVCNAME} + else + fidfile=/var/lib/fetchmail/.fetchids + fi + if [ ! -d ${piddir} ]; then + checkpath -q -d -o fetchmail:fetchmail -m 0755 ${piddir} || return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting ${RC_SVCNAME}" + start-stop-daemon --start --pidfile ${pid_file} \ + --user fetchmail --exec /usr/bin/fetchmail \ + -- -d ${polling_period} -f ${rcfile} \ + --pidfile ${pid_file} -i ${fidfile} + eend ${?} +} + +stop() { + ebegin "Stopping ${RC_SVCNAME}" + start-stop-daemon --stop --quiet --pidfile ${pid_file} + eend ${?} +} + -- cgit v1.2.3