django-crontab icon indicating copy to clipboard operation
django-crontab copied to clipboard

Why we can't add individual job and can't remove individual job to crontab

Open slalit360 opened this issue 4 years ago • 1 comments

Environment & Versions

  • Operating system:
  • Python:
  • Django:
  • django-crontab:

Settings

  • My django-crontab settings:
# crontab job for mail alerts
CRONJOBS_LOG_DIR = r"/var/log/celery3"
CRONJOBS_ERR_LOG = "cronjob_beat.log"
CRONTAB_COMMAND_SUFFIX = '2>&1'

CRONJOBS = [
	('*/60 * * * *', 'integrations.notification_util.trigger_updates_inbox', '>> {} 2>&1'.format(os.path.join(CRONJOBS_LOG_DIR, CRONJOBS_ERR_LOG))),
    ('*/30 * * * *', 'integrations.notification_util.trigger_updates_proc', '>> {} 2>&1'.format(os.path.join(CRONJOBS_LOG_DIR, CRONJOBS_ERR_LOG)),
]

Details

  • Output of crontab -l after running python manage.py crontab add.
Then both jobs will be added .
  • Output of crontab -l after running python manage.py crontab remove.
Then both jobs will be removed.
  • If this output contained a crontab run command and I copy this command to my terminal the job works: yes/no

slalit360 avatar Jan 21 '21 04:01 slalit360

CRONJOBS in settings is a list. All elements in the list will get added to cron. If you do not want to add a job, then you will have to remove it from the list.

hnhegde avatar Nov 05 '23 05:11 hnhegde