cron @reboot ubuntu ldap dependency

Question: Users can configure cronjobs @reboot, but the cron environment is not ready for users at boot time. How can cron be forced to run only after the system is ready for users on Ubuntu?

On a Ubuntu 19.04 server I created the following cronjob:

crontab -l
@reboot /usr/local/bin/forever start -c /usr/local/bin/node /home/username/subdirectory/someservice.js

After reboot the syslog says:

Jul 26 16:30:06 METIS systemd[1]: cron.service: Succeeded.
Jul 26 16:31:59 METIS cron[1287]: (CRON) INFO (pidfile fd = 3)
Jul 26 16:31:59 METIS cron[1287]: (username) ORPHAN (no passwd entry)

My system (METIS) is using ldap which works without problems for normal use but when used with cron @reboot it cannot find the user, probably because ldap or the network is not yet started when cron is executing the @reboot command.

I found a patch for debian which changes the cron.init file. Although Ubuntu and Debian are related, I cannot find a cron.init file on Ubuntu 19.04

On Ubuntu, can cron be forced to run AFTER the system has been set up to work for all users? How?

5 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like