# Vixie cron dies once  week, how to check and restart ?

## GentooStarter

My cacti servies heavily relies on vixie cron.  Sadly my cron deamon dies about once a week.. Usual during the weekend, which creates large hooles in my graphs..

My first thought was simply restarting the cron once a day by using a cronjob.. which works fine unless the cron dies  :Smile:  Not helping me there..

Is there a way to check if the crojn is still running and if not restart it without using the cron ??

----------

## bunder

anything in the syslogs that says why it crashed?

cheers

----------

## GentooStarter

Nope.. not a thing.. the cron log shows the normale output and then stops all of a sudden..

nothing to be found in any log file, no specific process is started at that time..

The machine has plenty of memory etc.. 

i can just do /etc/init/d/vixie-cron restart which shows no stop action, only a start action..

----------

## nativemad

Until you get it solved you could do an endless wile loop in a bash script like:

```

#!/bin/bash

ENDLESS=loop

while ! [ $ENDLESS = "stop" ]; do

   TESTSERVER=(`ps -e | grep cron`)

   if [ -z $TESTSERVER ]; then

     do some stuff here... like writing a mail or such....

     /etc/init.d/vixie-cron restart

   fi

   sleep 30s

done

```

Cheers

----------

## Hu

Are you using a hardened profile?  What version of vixie-cron?  You can answer both questions with emerge --info ; emerge --pretend --verbose sys-process/vixie-cron.

Try rebuilding cron with debug symbols and leaving a gdb attached to it.  If it is dying due to a fatal signal, gdb should be able to record the signal.  See How to get meaningful backtraces in Gentoo to learn how to set up debug symbols.

----------

## GentooStarter

hostname ~ # emerge --info ; emerge --pretend --verbose sys-process/vixie-cron

Portage 2.1.4.4 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.24-gentoo-r3 i686)

=================================================================

System uname: 2.6.24-gentoo-r3 i686 Intel(R) Xeon(TM) CPU 3.20GHz

Timestamp of tree: Sun, 01 Jun 2008 01:45:01 +0000

app-shells/bash:     3.2_p33

dev-lang/python:     2.4.4-r13

dev-python/pycrypto: 2.0.1-r6

sys-apps/baselayout: 1.12.11.1

sys-apps/sandbox:    1.2.18.1-r2

sys-devel/autoconf:  2.61-r1

sys-devel/automake:  1.10.1

sys-devel/binutils:  2.18-r1

sys-devel/gcc-config: 1.4.0-r4

sys-devel/libtool:   1.5.26

virtual/os-headers:  2.6.23-r3

ACCEPT_KEYWORDS="x86"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=i686 -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"

CXXFLAGS="-O2 -march=i686 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="acl apache2 apm authdaemond berkdb cgi chroot cli cracklib crypt ctype dba fortran gd gdbm iconv imagemagick imlib lm_sensors logrotate midi mudflap mysql ncurses nls nptl nptlonly offensive openmp pam pcre perl php png procmail python readline reflection serial session snmp sockets spl sql ssl suid sysfs tcpd unicode vda vhosts x86 xml zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] sys-process/vixie-cron-4.1-r10  USE="pam -debug (-selinux)" 0 kB 

Total: 1 package (1 reinstall), Size of downloads: 0 kB

----------

## MorpheuS.Ibis

you could set up watchdog daemon to monitor cron.pid and use a repair binary (cron restart script in this situation) when a problem is detected

----------

## lesourbe

the post title is wrong.

you should NEVER try to fix things like that !

----------

## nativemad

 *Quote:*   

> you should NEVER try to fix things like that !
> 
> 

 

hmm... I wonder how you would fix this specific issue!   :Shocked: 

-It's unknown if its a segfault or something.

-Happens about once a week 

-It's a productive system (gaps in cacti are very ugly! Probably there is some kind of alert set up [thold])

Would you for example compile vixie-cron with different useflags? Or emerge -eD vixie-cron?

What then? start it, wait a week and try and error??

Sorry, exactly for this case is my little code-snippet or watchdog or something good! To keep it running until you found the real cause of the problem...  :Wink: 

----------

## lesourbe

 *nativemad wrote:*   

> 
> 
> Sorry, exactly for this case is my little code-snippet or watchdog or something good! To keep it running until you found the real cause of the problem... 

 

ahhh, ok !   :Laughing: 

----------

