Question

Why isnt my cron job working?

For some reason my cron entry isn’t running at all. I’m trying to make a job that executes ZNC after reboots and crashes.

The commands I tried:

*/10 * * * * /usr/local/bin/znc >/dev/null 2>&1

Also tried adding the user:

*/10 * * * * znc-admin /usr/local/bin/znc >/dev/null 2>&1

Neither one is working. These were added using the “crontab -e” command, under root user.

These were tested by rebooting and waiting 10 minutes for the command to work.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Thank you for your answer. I had the same problem. Now it’s okay. If you also need help I work for this service and I can help you.

@MikeChops Sorry, but I don’t agree @ioanmoldovan199, you have enough stars.

*/10 * * * * part is OK. General syntax is OK - * * * * * * where from left to right * means: 1 - Minute (0-59) 2 - Hour (0-23) 3 - Day of Month (1-31) 4 - Month (0-7) 5 - Day of Week (0-6) 6 - Command So, your syntax means execute command every 10 minutes. */10 on minute part, means it’ll be repetitive - it’ll execute every 10 minutes.

Even if you look at ZNC wiki, you’ll see that same line:

*/10 * * * * /usr/local/bin/znc >/dev/null 2>&1

My guess is that command is invalid. What could be a problem? Well, maybe ZNC is not located at /usr/local/bin/znc. Verify location of it using which command. which will return you where it is stored. Execute this:

  1. which znc
Sample output of 'which'
/usr/bin/znc

If you installed using apt-get, you’ll probably have it in /usr/bin/znc instead of /usr/local/bin/znc, so line for crontab would be:

*/10 * * * * /usr/bin/znc >/dev/null 2>&1

If output of which is something other, use it.

To verify is it problem, you can try executing location of it - /usr/local/bin/znc. If you type this in terminal:

  1. /usr/local/bin/znc

In case it is under that location you’ll see something along:

Sample output
[ .. ] Checking for list of available modules... [ >> ] ok ...

(or any valid ZNC output). Well, if it isn’t under that location, you’ll see this:

Sample output
-bash: /usr/local/bin/znc: No such file or directory

The problem with the cronjob is that it has one extra star (which causes a syntax error). Replace it with this one:

*/10 * * * /usr/local/bin/znc >/dev/null 2>&1