cron stopped working

updated to php8, so screen squid stopped working, removed php8, installed back php7, now cron is not starting…
sudo systemctl status cron
● cron.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
Active: inactive (dead)

restarting just hangs there…

What are you using cron for… should be using systemd and timers to trigger jobs… don’t even use it here :wink:

As cron is now managed by systemd, I see no problem in using it. After all it is almost 50 years old now and will be very difficult to remove from all systems, habits and brains.

No cron or cronie or files in any /etc/cron.* directory installed here… systemd timers… plus I can run some tasks in seconds, not minutes :wink:

That is only part of (extensions of) cron. Thing of the system manager.

AFAIK, the user interface (the crontab tool) is still available and works as intended. Probably with systemd under the hood, but that is of no concern to the end-users.

some of the lines in crontab are:

*/12  * * * *    root     sudo sarg -x -z > /dev/null 2>&1
0     23    * *    4    ufdb    /usr/bin/sh -c "/usr/local/ufdbguard/blacklists/downloads/" > /dev/null 2>&1
0     23    * *    1    ufdb    /usr/bin/sh -c "/usr/local/ufdbguard/blacklists/downloads/" > /dev/null 2>&1
*/5  * * * *     root    sudo /srv/www/htdocs/screensquid/ > /dev/null 2>&1

i am open to new ideas, how to configure timers?

Just a service for your script and a timer for when you want to run…

I have an hourly update running for some conky info;

cat conky_sysinfo.service

# /etc/systemd/system/conky_sysinfo.service

Description=Run hourly system information for conky

ExecStart=/bin/sh -c "/data/configuration/bin/zzconky_tw"


cat conky_sysinfo.timer 

# /etc/systemd/system/conky_sysinfo.timer

Description=Systemd hourly timer for conky system information

OnCalendar=*-*-* *:00:00


One I run every 30 seconds for frequency info…

cat conky_cpu_freq.service

# /etc/systemd/system/conky_cpu_freq.service

Description=Run check_frequency script for conky

ExecStart=/usr/bin/bash -c "/data/configuration/bin/check_frequency >/dev/null 2>&1"


cat conky_cpu_freq.timer

# /etc/systemd/system/conky_cpu_freq.timer

Description=Systemd timer for check_frequency script



hmm but how to run ,say, every ten minutes?

Have a read here:




Apart from Malcom’s advise to use systemd timers.
Who’s crontab is this?
And take e.g. this one:

*/12  * * * *    root     sudo sarg -x -z > /dev/null 2>&1

whre apparently

root     sudo sarg -x -z > /dev/null 2>&1

is the command to be executed???
It is of course possible you have a command ‘root’, but it is not on my system.

It looks all very strange to me.

Have you tried “man 5 crontab”?

sarg - Squid Analysis Report Generator

-x Writes debug messages to stdout-z Writes process messages to stdout

Please re-read the command. It is NOT sarg, it is root.

The root user is running sudo sarg (to switch to squid user?), timers/services make much more sense :wink:

Where did you read that? in man 5 crontab?
There are 6 fields in a crontab entry. The first five are for the timing. The rest is the command to be executed. There is not such a thing as a username field.

And when the OP does not have a correct command, it will never run, using cron, systemd timer or what ever.

what can i write? thank you very much! timers work perfectly…
but i would like to fix the cron problem, seems like a bug to me…
root is just the user running the command… i have almost never used crontab -e… i just edit crontab directly…
but the content of it is not much of the matter as uninstalling cronie and reinstalling puts the default crontab and with it,
cron still does not start.
sarg better work with cron as it had scripts installed in cron daily, weekly and monthly.

And why do you think that you can put a username there? Did you read

man 5 crontab

as @avidjaar suggested?
As it is, it will most probably write to stdout

If 'root' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf root

But as you send all output to /dev/null, you will never see this.

The user that executes your crontab entry is the user that owns the crontab. I asked you who’s crontab it is, you did not answer >:(.

You should always use

crontab -e

else things will not all go as expected.

Just check what timers are running, (systemctl list-timers) you can just hook into one of those, else just check the scripts running an move to timers/services…

thanks for the advice… i had just enabled the .service services and then noticed that they only ran once… since i enabled the timers, things are awesome, this new method even allows a service to run from a non root user…
here is my give back, perhaps you don’t know about yet:
check this:

sudo /sbin/sysctl -w vm.drop_caches=3 
sudo /bin/sync && /bin/echo 3 | sudo /usr/bin/tee /proc/sys/vm/drop_caches