Forum Discussion

crosson_16669's avatar
crosson_16669
Icon for Nimbostratus rankNimbostratus
Aug 13, 2013

Basic Crontab setup

I can't seem to get my bigip to run a simple cron. Below is the script run

config_sync_script.py

!/usr/bin/python
import os

failover_status = os.popen("b failover show").read().split()[1]
sync_status = os.popen('tmsh show sys config-sync | grep "Status"').read().split()[1]

if failover_status == 'active' and sync_status == '1':
        os.system('tmsh run sys config-sync')
    config  ls -la | grep config_sync_script.py

    -rwxr--r--  1 root   root           274 Aug 13 09:06 config_sync_script.py
    crontab -l
    Active] config  crontab -l
     cron tab for root
    1-59/30 * * * * /usr/bin/diskmonitor
    18 9 * * * /config/config_sync_script.py

The time just matches a time I was working on it. In monitoring the cron log nothing happens and the script never seems to run. What am I missing?

  • You might go with tmsh show sys failover instead of b failover show to future proof that script, b commands are gone in 11.x. Also in 11.x, the second command is tmsh show cm sync-status.

     

    For now, could you try something like:

     

    18 9 * * * root /usr/bin/python /config/config_sync_script.py 1>/var/tmp/configsync.log 2>&1

     

  • I agree but I'm stuck on 10.2.4 so the B command is all I have for now.

     

    Good call on outputting to a logfile. I'll give it a shot and let you know. Thanks Jason!

     

  • Found the issue. Piping the out to a file helped.

     

    http://support.f5.com/kb/en-us/solutions/public/11000/600/sol11635