Homegear restarts every 10 minutes

Hi,
I’ve installed the image from https://homegear.eu/downloads/rpi_homegear_jessie_20160417_openhab.zip on my rPi. I’ve seen in my logs that Homegear is restarted every 10 minutes. Does someone know a reason for this behaviour?

Can you post your homegear.log?

[quote=“gowif”]Hi,
I’ve installed the image from https://homegear.eu/downloads/rpi_homegear_jessie_20160417_openhab.zip on my rPi. I’ve seen in my logs that Homegear is restarted every 10 minutes. Does someone know a reason for this behaviour?[/quote]

The restart is caused by the included script /scripts/checkServices.sh. This script is executed every 10 minutes as a cronjob. So maybe the script is faulty?

Hi,

sorry for the late reply. So it works, when you disable the cron job? What is the output of

ps -A | grep homegear -c

That’s basically what “checkServices.sh” is executing.

Cheers

Sathya

Yes, no restarts when the cron job is disabled.

pi@raspberrypi:~$ ps -A | grep homegear -c 2

[code]pi@raspberrypi:~$ sudo cat /scripts/checkServices.sh
#!/bin/bash
return=0
if [ $return -lt 1 ] && test -e /var/run/homegear/homegear.pid; then
LOGDIR=/var/log/homegear
if test -e $LOGDIR/core; then
COREDIR=$LOGDIR/coredumps
mkdir -p $COREDIR
DIR=0
while test -d $COREDIR/$DIR; do
((DIR++))
done
COREDIR=$COREDIR/$DIR
mkdir -p $COREDIR
mv $LOGDIR/core $COREDIR
mv $LOGDIR/homegear.log $COREDIR
mv $LOGDIR/homegear.err $COREDIR
cp /usr/bin/homegear $COREDIR
fi

    /etc/init.d/homegear restart

fi
[/code]

[code]pi@raspberrypi:~$ sudo bash -x /scripts/checkServices.sh

  • return=0
  • ‘[’ 0 -lt 1 ‘]’
  • test -e /var/run/homegear/homegear.pid
  • LOGDIR=/var/log/homegear
  • test -e /var/log/homegear/core
  • /etc/init.d/homegear restart
    [ ok ] Restarting homegear (via systemctl): homegear.service.[/code]

pi@raspberrypi:/var/log$ sudo ls homegear homegear.err homegear.err.2.gz homegear.log.1 homegear-scriptengine.err homegear-scriptengine.log.1 homegear.err.1 homegear.log homegear.log.2.gz homegear-scriptengine.log homegear-scriptengine.log.2.gz

Thanks! There was an error in the image (it shouldn’t say in the script “return=0”), which is fixed now.

Updated today -> Homegear version 0.6.6-1463

Homegear restarts every 10 Min. Cronjob disabled -> all fine

ps -A | grep homegear -c 1

[code]#!/bin/bash
return=0
if [ $return -lt 1 ] && test -e /var/run/homegear/homegear.pid; then
LOGDIR=/var/log/homegear
if test -e $LOGDIR/core; then
COREDIR=$LOGDIR/coredumps
mkdir -p $COREDIR
DIR=0
while test -d $COREDIR/$DIR; do
((DIR++))
done
COREDIR=$COREDIR/$DIR
mkdir -p $COREDIR
mv $LOGDIR/core $COREDIR
mv $LOGDIR/homegear.log $COREDIR
mv $LOGDIR/homegear.err $COREDIR
cp /usr/bin/homegear $COREDIR
fi

    /etc/init.d/homegear restart

fi
[/code]

without return = 0 -> all fine

I removed the script now, as with systemd it is obsolete anyway.