Clarity on configuration of notify_push for nextcloud

Hello there,
I am a bit confused on setting up notify_push on nextcloud. The Nextcloud admin documentation and notify push setup command doesn’t seem to show the same thing.

I am using systemd to setup and this is what it looks like based on admin documentation

Description=Nextcloud cron.php job

ExecCondition=php -f /var/www/nextcloud/occ status -e
ExecStart=/usr/bin/php -f /var/www/nextcloud/cron.php

and this is from sudo -u apache php occ notify_push:setup command

ExecCondition=php -f /var/www/html/nextcloud/occ status -e
ExecStart=/var/www/html/nextcloud/apps/notify_push/bin/x86_64/notify_push /var/www/html/nextcloud/config/config.php

I followed the notify_push command to configure it.
I am not facing any warnings or errors on “Security and Setup Warning” but on background jobs, it shows this
The last job execution ran 20 minutes ago. Something seems wrong.

You want to use systemd? Maybe list your timers:

systemctl list-timers -all

Also you can use CRON instead. Read here.

I did created a timer to trigger the service file,

The configuration seems fine although there is an error showing Last background job execution ran 17 hours ago error

Hi @Amanuel_Elhanan

You’re mixing up two completely different things here:

1. Background jobs (Nextcloud Cron Job)

The “Nextcloud Cron Job”, or the periodic execution of the cron.php script, performs various background tasks and should ideally be run every 5 minutes. You can either create a SystemD timer or a standard cron job to achieve this.

Background jobs via SystemD:

Create a service file:

Description=Nextcloud cron.php job

ExecCondition=php -f /var/www/html/nextcloud/occ status -e
ExecStart=/usr/bin/php -f /var/www/html/nextcloud/cron.php

Create a SystemD timer:

Description=Run Nextcloud cron.php every 5 minutes


systemctl daemon-reload
systemctl enable nextcloudcron.timer

Background jobs via cron:

apt install cron
crontab -u www-data -e

Add the following line:

*/5 * * * * php -f /var/www/html/nextcloud/cron.php

2. Client Push (notify_push)

Notify_push is completely optional and therefore not needed to solve the error message you are getting about the background jobs not running.

You can find instructions on how to set it up here: GitHub - nextcloud/notify_push: Update notifications for nextcloud clients

1 Like

@bb77 Thank you so much, I was wrong and now I know.
After I setup the corn job using systemd, the error gone but still there is a warning saying
Some jobs have not been executed since 10 days ago. Please consider increasing the execution frequency.

Never mind after a while it worked fine

1 Like

Yes, that is because some background jobs only run once a day. When an hour is defined for 'maintenance_window_start' in config/config.php, the background jobs which advertise themselves as not time sensitive will be delayed during the “working” hours and only run in the 4 hours after the given time. This is e.g. used for activity expiration, suspicious login training and update checks.
That could be the reason why that warning disappeared delayed.

Much and good luck,