I have setup a cron job by using django crontab. As per defined in documentation I defined a test job in cron.py and defined it to run in 1 minute interval in settings.py.
#cron.py
def test_cron_run():
print("\n\nHello World....!! ",timezone.now())
#settings.py
INSTALLED_APPS = [
'material.theme.cyan',
'material',
'material.admin',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
'django_crontab',
]
CRONJOBS = [
('*/1 * * * *', 'myapp.cron.test_cron_run','>>'+os.path.join(BASE_DIR,'log/debug7.log')),
]
I have added the cron jobs by running python3 manage.py crontab add
.
Also the job is added as I can see if I run, python3 manage.py crontab show
However I cannot see any log file being generated.
Is there any way to debug this, the os logs or something?
>>
? – Headroom('*/1 * * * *', 'myapp.cron.test_cron_run', '>> test.log'),
instead? – Hysterics