Strategic IT Consulting and Implementation Services

Nextcloud Cron Issues on Debian Fix

I started having problems with cron running as recommended on Debian because something changed and it makes sense that it would not be able to run because the webserver Debian user doesn’t have a default shell. I don’t know how this really was working technically at all ever, but I swear it was at one time.

Anyway, it got annoying to see alerts on the cron task in NextCloud not running. The Nextcloud Background Jobs page had some options here but running cron via the crontab didn’t work and that is because the Apache webserver linux user (typically www-data) has a shell of

/usr/sbin/nologin

Which you kind of want to keep so if/when there is a security issue on a webserver, there is not an easy permission escalation in linux. So, I didn’t want to change something like that. Instead, I went the webcron route and just do a cron entry to go have wget request the Nextcloud cron.php URL locally.

Here is what I did:

As root, edit crontab to add the Nextcloud cron entry

# crontab -e 

and add the cron entry with the webserver path for wget

*/5 * * * * /usr/bin/wget --spider --no-check-certificate "https://localhost/nextcloud/cron.php" >/dev/null 2>&1

Save out and restart cron

# /etc/init.d/cron restart

That should do it. Also, go to Nextcloud admin and set the preference to webcron. I just made the change so the “Something seems wrong” is wrong.

About the author

Jonathan Mergy

1 comment

Strategic IT Consulting and Implementation Services