#!/sbin/runscript # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ opts="${opts} reload" depend() { need net before mta after clamav dspam spamd mysql postgresql } # set CHROOT eval `grep "^ *CHROOT *=" /etc/sagator.conf | sed 's/^ *CHROOT *= */CHROOT=/'` start() { ebegin "Starting sagator" if [ "${SAGATOR_CONFIGURED}" -ne "1" ]; then eerror "Sagator has not been configured yet!" eerror "Please consult Sagator's documentation" eerror "and edit /etc/mail/sagator/sagator.conf appropriately!" eerror "Do not forget to set the SAGATOR_CONFIGURED variable in" eerror "/etc/conf.d/sagator to 1 (one), otherwise Sagator" eerror "will refuse to start!" eend 1 "Failed to start stagator" else # bind clamav data do chroot if [ "`echo $CHROOT/var/lib/clamav/*`" = "$CHROOT/var/lib/clamav/*" ]; then mount -n --bind /var/lib/clamav $CHROOT/var/lib/clamav \ > /dev/null 2>&1 fi if [ "${SAGATOR_OPTS}" != "" ]; then start-stop-daemon --start --quiet --pidfile "${SAGATOR_PID}" \ --exec /usr/sbin/sagator -- "${SAGATOR_OPTS}" else start-stop-daemon --start --quiet --pidfile "${SAGATOR_PID}" \ --exec /usr/sbin/sagator fi eend $? "Failed to start sagator" fi } stop() { ebegin "Stopping sagator" start-stop-daemon --stop --quiet --pidfile "${SAGATOR_PID}" /usr/sbin/sagator --wait eend $? "Failed to stop sagator" rm -f "${SAGATOR_PID}" # try to umount chroot umount $CHROOT/var/lib/clamav 2>/dev/null || true } reload() { ebegin "Reloading sagator" start-stop-daemon --stop --quiet --signal HUP --pidfile "${SAGATOR_PID}" eend $? "Failed to reload sagator" }