Skip navigation
2419 Views 5 Replies Latest reply: Oct 18, 2011 10:56 PM by Shane Scott RSS
mura Rank: White Belt 50 posts since
Jul 10, 2008
Currently Being Moderated

Oct 13, 2011 3:56 AM

how to run zencommand in the cron

My zenoss zencommand process always down。

I want to make a cron to check zencommand process status,if zencommand isnot run,then start this process。

 

#!/bin/bash

export ZENHOME="/opt/zenoss"

export PATH="${ZENHOME}/bin:${PATH}"

export PYTHONPATH="/opt/zenoss/lib/python"

export LD_LIBRARY_PATH="/opt/zenoss/lib"

status=`zencommand status | grep pid| wc -l`

if [ 0 -eq $status ]

  then  /opt/zenoss/bin/python /opt/zenoss/Products/ZenRRD/zencommand.py --configfile /opt/zenoss/etc/zencommand.conf --cycle --daemon

fi

 

I run this scripts by zenoss role well。

but run cron by zenoss.the start action no run.

 

*/2 * * * * zenoss /home/zenoss/check_zencommand

 

how can run start command in the cron?

  • jcurry ZenossMaster 1,021 posts since
    Apr 15, 2008
    Currently Being Moderated
    1. Oct 13, 2011 2:40 PM (in response to mura)
    Re: how to run zencommand in the cron

    Several things here...

     

    First, I think you should examine $ZENHOME/log/zencommand.log and try and find out why the daemon is failing - it doesn't normally.  Restarting may not buy you anything.  How long does it run for?

     

    Make sure that you put your cron entry into the zenoss user's crontab and take out the "zenoss" parameter in your cron line above.

     

    Do just check that your shellscript is executable?

     

    I would simply do a

    $ZENHOME/bin/zencommand restart

     

    as my then clause - but I wouldn;t do this until I know why it is failing.

     

    Cheers,

    Jane

  • jcurry ZenossMaster 1,021 posts since
    Apr 15, 2008
    Currently Being Moderated
    3. Oct 14, 2011 4:11 AM (in response to mura)
    Re: how to run zencommand in the cron

    On the problem determination, see if there is anything in event.log - that gets many generic, inter-process messages. 

     

    Not sure what your libgpg-error messages are in your log.  Was this a stack-build install or did you build from rpms?  I'm wondering if you have pre-req problems.  Is there anything in /var/log/messages.

     

    You might just check and make sure that you are not short on filesystem space.  Zenoss uses temporary disk space under the covers so if you are short of space in / or /tmp this may cause oddities.

     

    With regard to your cron entry, as the zenoss user, run crontab -e and add an entry - here's one of mine:

    0 1 * * * /usr/local/zenoss/zenoss/local/jc_zenbackup.sh

     

    In my case, $ZENHOME is /usr/local/zenoss/zenoss.

     

    Cheers,

    Jane

  • Shane Scott ZenossMaster 1,373 posts since
    Jul 6, 2009
    Currently Being Moderated
    5. Oct 18, 2011 10:56 PM (in response to mura)
    Re: how to run zencommand in the cron

    mura:

     

    I reccomend you update your zencommand.conf and zenhub.conf to set the logging to debug level. That way we can figure why it keeps breaking.

     

    As for the cron job, to be honest, I'd just cron root /sbin/service zenoss start. Service zenoss start will skip daemons already running and start those that have failed plus handle all environment setup. A cron to start failed daemons isn't a solution- please post your debug level zenhub.log and zencommand.log soon as you can.

     

    Thanks!

     

    Best,

    --Shane W. Scott(Hackman238)

      ZCA - http://community.zenoss.org/community/zca/blog

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points