#!/bin/sh #---------------------------------------------------------------------------------- # /var/install/bin/antispam-control - control process to monitor spamd # # Copyright (c) 2001-2024 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2004-12-01 jed # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------------- # read eislib . /var/install/include/eislib #exec 2>/tmp/antispam-control-trace-$$.log #set -x antispam_run_path=/run/antispam interval=20 # start control process if [ -f ${antispam_run_path}/antispam-control.start ] then while [ 1 ] do { if [ -f ${antispam_run_path}/antispam-restart-request ] then # stop process /etc/init.d/antispam stopspamd /usr/bin/logger -p "local7.warning" -t "antispam" "process control has stopped spamd as requested!" sleep 2 rm -f ${antispam_run_path}/antispam-restart-request fi # check if spamd process is running pid=`ps -ef | tr -s ' ' ' ' | grep -v grep | grep -w "spamd" | awk '{ print $2 }' 2>/dev/null` if [ -z "${pid}" ] then # no - restart process /etc/init.d/antispam startspamd /usr/bin/logger -p "local7.warning" -t "antispam" "process control has restarted spamd!" sleep 2 fi } > /dev/null sleep ${interval} done & else mecho --info "Please use the service command to start/stop or restart antispam processes." fi