profile-image

rdonato

Riccardo Donato Milano, Italy
Service Monitor

Plasma 4 Widgets 72 comments

Score 88%
88 Likes
12 Dislikes
Nov 01 2011
May be I am wrong..but you are using "proc.exitCode()" and your original check calls pidof which returns an exit code. Running ps returns everytime 0. That's why your check fails...from pidof man:

EXIT STATUS
0 At least one program was found with the requested name.

1 No program was found with the requested name.
- Nov 03 2011
Hi,

humm...I think it fails because you are going to expect a return code from the test....that's why i used a custom shell script to check mysql instances. - Nov 02 2011
look at my recent post I fixed mysqld issue under kde - Oct 18 2011
Humm I was wrong..you are expecting an exit code from the check...I fixed it adding a custom shell script for mysql process (put it in your path):


#!/bin/sh
SERVICE=$1
if [ "$SERVICE" = "akonadi" ]
then
if ps fax | grep -v grep | grep "mysqld" | grep $SERVICE > /dev/null
then
echo "$SERVICE service running, bye bye"
exit 0
else
echo "$SERVICE is not running"
exit 1
fi
else
if ps fax | grep -v grep | grep "mysqld" | grep -v "akonadi" > /dev/null
then
echo "Mysqld service running, bye bye"
exit 0
else
echo "$SERVICE is not running"
exit 1
fi
fi


And daemons-common.xml:


<service id="mysql-daemon for kde env" priority="0">
<name>MySQL Database for KDE Env</name>
<description>Database server used by kde (stopping could be a bad idea)</description>
<installcheck>ls $INITDIR/mysql</installcheck>
<runningcheck>pidofmysql.sh akonadi</runningcheck>
<startcommand>$SUDO $INITDIR/mysql start</startcommand>
<stopcommand>$SUDO $INITDIR/mysql stop</stopcommand>
</service>

<service id="mysql-daemon" priority="0">
<name>MySQL Database</name>
<description>Database server</description>
<installcheck>ls $INITDIR/mysql</installcheck>
<runningcheck>pidofmysql.sh mysql</runningcheck>
<startcommand>$SUDO $INITDIR/mysql start</startcommand>
<stopcommand>$SUDO $INITDIR/mysql stop</stopcommand>
</service>
- Oct 18 2011
You should change mysqld job detection: it fails on kde because akonadi uses mysqld for its embedded db. I added a new service for akonadi mysqld job and a new check for running jobs.

<service id="mysql-daemon for kde env" priority="0">
<name>MySQL Database</name>
<description>Database server used by many programs (stopping could be a bad idea)</description>
<installcheck>ls $INITDIR/mysql</installcheck>
<runningcheck>ps fax|grep mysqld|grep "akonadi"|cut -d"?" -f1|grep -v grep</runningcheck>
<startcommand>$SUDO $INITDIR/mysql start</startcommand>
<stopcommand>$SUDO $INITDIR/mysql stop</stopcommand>
</service>

<service id="mysql-daemon" priority="0">
<name>MySQL Database</name>
<description>Database server used by many programs (stopping could be a bad idea)</description>
<installcheck>ls $INITDIR/mysql</installcheck>
<runningcheck>ps fax|grep mysqld|grep -v "akonadi"|cut -d"?" -f1|grep -v grep</runningcheck>
<startcommand>$SUDO $INITDIR/mysql start</startcommand>
<stopcommand>$SUDO $INITDIR/mysql stop</stopcommand>
</service>
- Oct 18 2011
Service Monitor

Plasma 4 Widgets

Score 88%
88 Likes
12 Dislikes
Oct 18 2011