question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ldap_sync_users as cronjob

See original GitHub issue

Hi,

I’m currently trying to make the ./manage.py ldap_sync_users a cronjob within a docker container so the application im builing gets synced every x hours.

My problem however is that the command wont execute through the cronjob, also I’m well aware this might not be the proper place to ask since the issue lies most likely within cron but I don’t know where else to ask.

If I run any other ./manage.py command like migrate or whatsoever it gives me output and tries to actually do stuff however on ldap_sync_users nothing is happening.

If I run the command by hand within the container everything works like a charm so the problem is within cron I guess.

Anyone have experience with this?

Regards,

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
BlowMaWhistlecommented, Aug 26, 2019

I finally made some progress. there was error output, it was just not being redirected right. &>> doesn’t work within crontab, maybe because its sh instead of bash?

by correctly redirecting output with 1> /var/log/cron.log 2> /var/log/cron.err I finally got the error message LDAPOperationsErrorResult now its just a matter of supplying cron with the correct ENV vars.

thanks for the help guys! this issue can be closed 😃

1reaction
etianencommented, Aug 26, 2019

Huh. I’m afraid that I have absolutely no idea why ldap_sync_users might behave differently in cron vs run manually.

If you get to the bottom of this, please let us know what the problem/solution was!

(It’s a good point about getting a “real” scheduler in early rather than later. I guess it’s just cost/benefit based on easy setup with cron, vs time to port over to something else if requirements outgrow cron. The tradeoff point will depend heavily on the sort of project you’re writing regularly. My projects exist in a space where celery is either far too much, or far too little!)

On Mon, 26 Aug 2019 at 12:42, Rick Suijkerbuijk notifications@github.com wrote:

my crontab file looks as following:

PATH=/usr/local/pyenv/shims:/usr/local/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

          • root python /opt/application/manage.py ldap_sync_users &>> /var/log/cron.log
          • root python /opt/application/manage.py migrate >> /var/log/cron.log

if i add these lines, the ./manage.py migrate executes successfully however the ./manage.py ldap_sync_users does nothing at all. no error messages just nothing, not even a stacktrace or something

i have verified that cron adds and executes the cronjobs from the crontab successfully its just the struggle with ldap_sync_users

thanks again for the quick reply to both of you

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/etianen/django-python3-ldap/issues/167?email_source=notifications&email_token=AABEKCF3RY5YMZ6C6BUCM6DQGO6Q7A5CNFSM4IPOFHRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5EDXRA#issuecomment-524827588, or mute the thread https://github.com/notifications/unsubscribe-auth/AABEKCC4DRQWWMJOP6RHFITQGO6Q7ANCNFSM4IPOFHRA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Configure LDAP Sync With CronJobs in OpenShift
Finally, we can set up the CronJob configuration that will perform the groups' synchronism. Before creating CronJob, it is necessary to gather ...
Read more >
openshift-management/cronjob-ldap-group-sync.yml at master
Set of maintenance scripts & cron jobs for OpenShift Container Platform - openshift-management/cronjob-ldap-group-sync.yml at master ...
Read more >
LDAP Sync - Snipe-IT Documentation
You can set up a cron to automatically sync LDAP users using the following: location and location_id are optional. So for example, if...
Read more >
Activating cron tasks to synchronize data - IBM
Specify a schedule for the cron task and save the changes. Allow the cron task run to synchronize all the users and groups...
Read more >
Automatic Ldap Sync/Import using cron job for community ...
Is there possible to automatically sync Ldap with processmaker and import all the user at regular interval of time using cron job for ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found