pkgsrc/mail/prayer/files/prayer.sh
schmonz 85e50a7d96 Update to 1.0.12. From the changelog:
* Apparently "mutex" is already claimed by a system header on Solaris.

* File locking on Linux (probably other operating systems) is pretty
    dumb when lots of processes are trying to lock a single file
    for serialisation: all of the processes are woken each time
    that the file is unlocked. Most of the process will simply loop
    inside the kernel and attempt to lock again. Presumably this
    approach makes nonblocking locks and EINTR easier to do, but
    it does mean that you can get occasional load average spikes.
    Add MUTEX_SEMAPHORE to implement System V semaphore based lock,
    which does not have this problem in Linux. Warning: System V
    semaphores are a finite resource, and they are not released
    automatically. See: prayer-sem-prune.

* Quotas now reported in MBytes rather than KBytes.

* Add download links for text/html and text/plain attachments

* Fix bug with body->type TYPEMESSAGE: c-client API very poorly
    documented :(

* Strip out common HTML entity encodings that might be used in
    HREFs with text/html attachments.

* Fix mydb_db3.c to work with DB4.

* Integrate into Tony's funky packaging system for Hermes and PPSW.

* Add interface to automatic spam folder pruning utility that I
    wrote for Cyrus (controlled through special Sieve files).

* Fix uploads where mailboxes contain NUL characters (translate to
    space?)

* Assorted minor bugfixes

* Fix nasty /redirect bug that I managed to introduce by switching
    from url_encode to canon_encode to work around bug in Opera.
    Missing a url_encode: infinite loop from dumb UAs :(. Otherwise
    identical to 1.0.9.

* Few minor bug fixes, covered in CVS history.

pkgsrc changes:
* Rename the source rc.d script in the default RCD_SCRIPTS style.
* Respect ${VARBASE}.
* Avoid the DB_VERB_CHKPOINT flag with latest db4 (where it's been removed).
* Patch from jdc@ for 64-bit big-endian hosts.

XXX rc.d script doesn't stop all the prayer slaves
2005-01-09 00:07:46 +00:00

118 lines
1.9 KiB
Bash

#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: prayer.sh,v 1.1 2005/01/09 00:07:47 schmonz Exp $
#
# This shell script takes care of starting and stopping prayer,
# a program providing web access to a mail server using IMAP
#
## only for NetBSD
# PROVIDE: prayer
# REQUIRE: LOGIN
# AFTER: mail
# KEYWORD: shutdown
##
PATH=/sbin:/bin:/usr/sbin:/usr/bin:@PREFIX@/sbin
export PATH
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
name="prayer"
rcvar=$name
command="@PREFIX@/sbin/prayer"
command_args=""
pidfile="@VAR_PREFIX@/pid/prayer"
prayer_flags=${prayer_flags-""}
OPSYS=@OPSYS@
get_prayer_pid()
{
if [ -f ${pidfile} ]; then
prayer_pid=`head -1 ${pidfile}`
if ps -p ${prayer_pid} | fgrep ${name} >/dev/null; then
:
else
prayer_pid=
fi
else
prayer_pid=
fi
}
prayer_start()
{
get_prayer_pid
if [ -n "${prayer_pid}" ]; then
echo "${command} already running as pid ${prayer_pid}."
return 1
fi
echo "Starting ${name}."
${command} ${prayer_flags} ${command_args}
}
prayer_stop()
{
get_prayer_pid
if [ -z "${prayer_pid}" ]; then
echo "${command} not running? (check ${pidfile})."
return 1
fi
echo "Stopping ${name}."
kill -HUP ${prayer_pid}
prayer_session_pid=`cat @VAR_PREFIX@/pid/prayer-session`
if [ -n "${prayer_session_pid}" ]; then
if ps -p ${prayer_session_pid} | fgrep ${name} >/dev/null; then
kill -HUP ${prayer_session_pid}
fi
fi
slaves=`ps -U prayer| cut -d' ' -f1`; kill -HUP $slaves
}
prayer_status()
{
get_prayer_pid
if [ -z "${prayer_pid}" ]; then
echo "${command} is not running? (check ${pidfile})."
else
echo "${command} is running as pid ${prayer_pid}."
fi
}
if [ "${OPSYS}" = "NetBSD" ]; then
stop_cmd=prayer_stop
load_rc_config $name
run_rc_command "$1"
else # not NetBSD
case ${1+"$@"} in
start)
prayer_start
;;
stop)
prayer_stop
;;
restart)
prayer_stop
sleep 2
prayer_start
;;
status)
prayer_status
;;
*)
echo "Usage: ${0} (start|stop|restart|status)"
;;
esac
fi