When you started manually, you need to replicate what the script does including the pid files. zmlogswatchctl has the following lines that get executed when you are asking for status if it's running.
Code: Select all
pidfile=${zimbra_log_directory}/logswatch.pid
zmrrdfetchpidfile=${zimbra_log_directory}/zmrrdfetch-server.pid
getpid()
{
if [ -f ${pidfile} ]; then
pid=$(cat ${pidfile})
fi
if [ -f ${zmrrdfetchpidfile} ]; then
zmrrdfetchpid=$(cat ${zmrrdfetchpidfile})
fi
}
checkrunning()
{
getpid
if [ "x$pid" = "x" ]; then
running=0
else
kill -0 $pid 2> /dev/null
if [ $? != 0 ]; then
pid=""
running=0
else
running=1
fi
fi
}
So you can manually do the following to see how/why zmlogswatchchtl might think programs it starts/stop isn't running.
Code: Select all
% cd /opt/zimbra/log
% cat logswatch.pid; cat zmrrdfetch-server.pid
19693
19795
% ps aux |egrep '(19693|19795)'
zimbra 19693 0.0 0.2 56596 17628 ? SNs 04:50 0:15 /opt/zimbra/common/bin/swatchdog --config-file=/opt/zimbra/conf/logswatchrc --use-cpan-file-tail --pid-file=/opt/zimbra/log/logswatch.pid --daemon --script-dir=/opt/zimbra/data/tmp --tail-file /var/log/zimbra-stats.log
zimbra 19795 0.0 0.0 60340 7828 ? SN 04:50 0:00 zmlogger: zmrrdfetch: server
The kill -0 construct from above is an odd way to determine if something is running. It doesn't send any signal and the kernel simply returns back a fail/success that you would be able to send a signal to that process if you have correct permissions. Most of the zimbra status scripts use this paradigm so that is why a lot of forum posts say to try and rm the pid file in case it existed with the wrong permissions and zimbra couldn't overwrite it. Note: what if pid's wrap and something else is running or if that pid file contains a low pid number and you have rebooted and one of the other programs now has that pid? Anyway...
start work like this. Note the amount of information that is saved in /var/log/zimbra.log
Code: Select all
Is there a swatch configuration file? If not log that "logswatchrc is missing"
Are the programs already running? If not log that" logwatch is already running"
Is logger service enabled? if not log that "logger service is not enabled! failed"
start swatchdog with --pid-file saved to the location shown above. Note: it will also start zmlogger from the swatchrc action.
Check that it is running and if it is... return back to zmcontrol status that everything is running
Normally, whenever something doesn't run from zmcontrol status - the first thing you do is something like:
Code: Select all
# su - zimbra
% zmlogswatchchtl restart
zmcontrol [start|stop|restart|status] calls zmlogswatchctl with the same argument. If that fails to fix it, look at the pid files in /opt/zimbra/log for permission problems or tail -f /var/log/zimbra.log as you attempt to restart it and look for why.
HTH,
Jim