#! /bin/sh #---------------------------------------------------------------------------------- # /var/install/bin/owswitch-control - monitor owswitch-status-monitor # # Copyright (c) 2016-2019 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2016-06-13 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/owswitch-control-trace-$$.log #set -x interval=20 # start control process if [ -f /var/run/owswitch-control.start ] then while [ 1 ] do { if [ -f /var/run/owswitch-restart-request ] then # stop process /etc/init.d/owswitch stop /usr/bin/logger -p "local0.warning" -t "owswitch" "process control has stopped owswitch-status-monitor as requested!" sleep 2 rm -f /var/run/owswitch-restart-request fi # check if spamd process is running pid=`pgrep -f owswitch-status-monitor` if [ -z "${pid}" ] then # no - restart process /etc/init.d/owswitch --quiet start /usr/bin/logger -p "local0.warning" -t "owswitch" "process control has restarted owswitch-status-monitor!" sleep 2 fi } > /dev/null sleep ${interval} done & else mecho --info "Please use '/etc/init.d/owswitch' to start/stop or restart the owswitch-status-monitor process." fi