summaryrefslogtreecommitdiff
path: root/network/opendkim/rc.opendkim
diff options
context:
space:
mode:
authorDavid Spencer <idlemoor@slackbuilds.org>2016-01-18 19:31:37 +0000
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2016-01-20 02:27:21 +0700
commit8395b8452665940e09465fab17a9c82af69fb8af (patch)
treec7e1185e0f30721298c55bb28426476bd4d0f103 /network/opendkim/rc.opendkim
parent9b826f2cb5cf183b56d1df827969211ccabbdca3 (diff)
downloadslackbuilds-8395b8452665940e09465fab17a9c82af69fb8af.tar.gz
network/opendkim: Renamed from network/OpenDKIM.
The source tarball and the built package already use "opendkim". Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'network/opendkim/rc.opendkim')
-rw-r--r--network/opendkim/rc.opendkim77
1 files changed, 77 insertions, 0 deletions
diff --git a/network/opendkim/rc.opendkim b/network/opendkim/rc.opendkim
new file mode 100644
index 0000000000..ae30ca7dea
--- /dev/null
+++ b/network/opendkim/rc.opendkim
@@ -0,0 +1,77 @@
+#!/bin/bash
+#
+# opendkim Start and stop OpenDKIM.
+
+# OpenDKIM startup script for Slackware 14.1 by Gerardo Zamudio
+# Modified from the script by Steve Jenkins (SteveJenkins.com) - 10-29-2012
+# Based on a script by Andrew Colin Kissa (TopDog) for dkim-milter - 05-28-2009
+
+USER="opendkim"
+PROGRAM=/usr/sbin/opendkim
+CONF_FILE=/etc/opendkim.conf
+PID_FILE=/var/run/opendkim/opendkim.pid
+KEYGEN=/usr/sbin/opendkim-genkey
+DKIM_KEYDIR=/etc/opendkim/keys
+DKIM_SELECTOR=default
+AUTOCREATE_DKIM_KEYS=yes
+
+do_dkim_keygen() {
+ if [ ! -s $DKIM_KEYDIR/$DKIM_SELECTOR.private ]; then
+ echo -n $"Generating default DKIM keys: "
+ if [ "x$(hostname -d)" = "x" ]; then
+ echo $"Cannot determine host's domain name, so skipping default key generation."
+ else
+ mkdir -p $DKIM_KEYDIR
+ $KEYGEN -b 2048 -D $DKIM_KEYDIR -s $DKIM_SELECTOR -d "$(hostname -d)"
+ chown root:$USER $DKIM_KEYDIR
+ chown $USER:$USER $DKIM_KEYDIR/$DKIM_SELECTOR.{private,txt}
+ chmod 600 $DKIM_KEYDIR/$DKIM_SELECTOR.private
+ chmod 644 $DKIM_KEYDIR/$DKIM_SELECTOR.txt
+ echo
+ echo Default DKIM keys for "$(hostname -d)" created in $DKIM_KEYDIR.
+ fi
+ fi
+}
+
+case "$1" in
+ start)
+ # Create keys if necessary
+ if [ "x${AUTOCREATE_DKIM_KEYS}" != xNO ]; then
+ do_dkim_keygen
+ fi
+
+ echo -n $"Starting OpenDKIM Milter... "
+ echo
+ if [ -f $PID_FILE ]; then
+ PID=$(cat $PID_FILE)
+ echo OpenDKIM already running as pid "$PID"
+ exit 2;
+ else
+ $PROGRAM -l -x $CONF_FILE -P $PID_FILE
+ fi
+ ;;
+ stop)
+ echo -n $"Stopping OpenDKIM Milter... "
+ echo
+ if [ ! -f $PID_FILE ]; then
+ echo OpenDKIM is not running!
+ exit 2;
+ else
+ kill -TERM "$(cat $PID_FILE)" && rm -rf /var/run/opendkim.pid
+ fi
+ ;;
+ status)
+ if [ -f $PID_FILE ]; then
+ PID=$(cat $PID_FILE)
+ echo OpenDKIM already running as pid "$PID"
+ exit 2;
+ else
+ echo OpenDKIM is not running!
+ fi
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|}"
+ exit 1
+esac
+
+exit $?