aboutsummaryrefslogtreecommitdiffstats
path: root/mail/dkimproxy
diff options
context:
space:
mode:
authormiwi <miwi@FreeBSD.org>2006-09-13 20:27:01 +0800
committermiwi <miwi@FreeBSD.org>2006-09-13 20:27:01 +0800
commitddff1792685395bbe15ca6bb6b7903bac179543d (patch)
tree1da7e73e8c0f2c5ea01f32080d4742f6f8d4268f /mail/dkimproxy
parent77dad6acbb9b7c1ebaf3aa55701d3867309604ce (diff)
downloadfreebsd-ports-gnome-ddff1792685395bbe15ca6bb6b7903bac179543d.tar.gz
freebsd-ports-gnome-ddff1792685395bbe15ca6bb6b7903bac179543d.tar.zst
freebsd-ports-gnome-ddff1792685395bbe15ca6bb6b7903bac179543d.zip
- rc.d scripts are changed:
- to log all messages at start-up time of a daemon, - to show error messages when some error occurs at that time, - and to checks $dkfilter_{in,out}_user exist or not. PR: ports/101024 Submitted by: Yoshisato YANAGISAWA <yanagisawa(at)csg.is.titech.ac.jp> (Maintainer)
Diffstat (limited to 'mail/dkimproxy')
-rw-r--r--mail/dkimproxy/files/dkimproxy_in.in25
-rw-r--r--mail/dkimproxy/files/dkimproxy_out.in27
2 files changed, 43 insertions, 9 deletions
diff --git a/mail/dkimproxy/files/dkimproxy_in.in b/mail/dkimproxy/files/dkimproxy_in.in
index 6a4e54ca16d4..e78554e4d9d3 100644
--- a/mail/dkimproxy/files/dkimproxy_in.in
+++ b/mail/dkimproxy/files/dkimproxy_in.in
@@ -34,11 +34,27 @@ dkimproxy_in_start()
echo "${name} already running?"
exit 1
fi
+ if pw user show "${dkimproxy_in_user}" > /dev/null 2>&1; then else
+ echo "dkimproxy_in_user: ${dkimproxy_in_user} not found"
+ exit 1
+ fi
+ echo "Starting ${name}"
+ logger -t ${name} "Starting ${name}"
touch ${dkimproxy_in_pidfile}
chown ${dkimproxy_in_user} ${dkimproxy_in_pidfile}
- su -m ${dkimproxy_in_user} -c "daemon -cf -p ${dkimproxy_in_pidfile} \
- %%PREFIX%%/bin/dkimproxy.in ${dkimproxy_in_flags}"
- echo "Starting ${name}"
+ logfile=`mktemp /tmp/${name}.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`
+ su -m ${dkimproxy_in_user} -c "daemon -c -p ${dkimproxy_in_pidfile} \
+ %%PREFIX%%/bin/dkimproxy.in ${dkimproxy_in_flags}" \
+ > /dev/null 2> ${logfile}
+ sleep 1 # XXX: wait until dkimproxy start.
+ logger -t ${name} "`cat ${logfile}`"
+ err=`grep Error ${logfile}`
+ if [ "${err}" ]; then
+ echo "Failed to start ${name}."
+ echo "${err}"
+ rm -f ${dkimproxy_in_pidfile}
+ fi
+ rm -f ${logfile}
}
dkimproxy_in_stop()
@@ -47,9 +63,10 @@ dkimproxy_in_stop()
echo "${name} not running?"
exit 1
fi
+ echo "Stopping ${name}"
+ logger -t ${name} "Stopping ${name}"
kill `cat ${dkimproxy_in_pidfile}`
rm -f ${dkimproxy_in_pidfile}
- echo "Stopping ${name}"
}
load_rc_config $name
diff --git a/mail/dkimproxy/files/dkimproxy_out.in b/mail/dkimproxy/files/dkimproxy_out.in
index 239039bd5277..c05aafd7e1dd 100644
--- a/mail/dkimproxy/files/dkimproxy_out.in
+++ b/mail/dkimproxy/files/dkimproxy_out.in
@@ -13,7 +13,7 @@
# dkimproxy_out_enable="YES"
#
# Before you enable dkimproxy.out, you also need to make your domainkey to
-# set it to DNS and configurate dkimproxy_flags.
+# set it to DNS and configurate dkimproxy_out_flags.
#
. %%RC_SUBR%%
@@ -39,11 +39,27 @@ dkimproxy_out_start()
echo "${name} already running?"
exit 1
fi
+ if pw user show "${dkimproxy_out_user}" > /dev/null 2>&1; then else
+ echo "dkimproxy_out_user: ${dkimproxy_out_user} not found"
+ exit 1
+ fi
+ echo "Starting ${name}"
+ logger -t ${name} "Starting ${name}"
touch ${dkimproxy_out_pidfile}
chown ${dkimproxy_out_user} ${dkimproxy_out_pidfile}
- su -m ${dkimproxy_out_user} -c "daemon -cf -p ${dkimproxy_out_pidfile} \
- %%PREFIX%%/bin/dkimproxy.out ${dkimproxy_out_flags}"
- echo "Starting ${name}."
+ logfile=`mktemp /tmp/${name}.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`
+ su -m ${dkimproxy_out_user} -c "daemon -c -p ${dkimproxy_out_pidfile} \
+ %%PREFIX%%/bin/dkimproxy.out ${dkimproxy_out_flags}" \
+ > /dev/null 2> ${logfile}
+ sleep 1 # XXX: wait until dkimproxy start.
+ logger -t ${name} "`cat ${logfile}`"
+ err=`grep Error ${logfile}`
+ if [ "${err}" ]; then
+ echo "Failed to start ${name}."
+ echo "${err}"
+ rm -f ${dkimproxy_out_pidfile}
+ fi
+ rm -f ${logfile}
}
dkimproxy_out_stop()
@@ -52,9 +68,10 @@ dkimproxy_out_stop()
echo "${name} not running?"
exit 1
fi
+ echo "Stopping ${name}"
+ logger -t ${name} "Stopping ${name}"
kill `cat ${dkimproxy_out_pidfile}`
rm -f ${dkimproxy_out_pidfile}
- echo "Stopping ${name}"
}
load_rc_config $name