- 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)
This commit is contained in:
parent
bca0c695ee
commit
37d071da1d
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=172937
2 changed files with 43 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue