First of all, apologize if you publish the problem in an improper place or even if you suppress any pre-established protocol for registering requests for help, that is, putting my problem without any necessary information.
I’m using NextCloud on:
Operating System: Linux 5.4.0-66-generic x86_64 / Zorin OS 15.3
CPU: Intel (R) Xeon (R) CPU E5-2667 0 @ 2.90GHz (9 colors)
Memory: 6.19 GB
NextCloud’s own information (system):
PHP version 7.4.14
MySQL database version 5.7.33
NextCloud version 20.0.7
The problem: everything works relatively well, even with external storage. I made the requested configuration in cron:
- / 5 * * * * php -f /snap/nextcloud/26119/htdocs/cron.php
However, despite running … after a few hours and nothing I do it again. The cron runs smoothly, minute by minute, but the top line does not. I tried several solutions in the last 2 weeks and nothing. Paleatively I found that if you reboot the server 2 times, it will work again and stay running for hours … then the problem will occur again with the well-known message of “something is wrong” and “last task ran at X hours” that are seen on the NextCloud basic settings page.
I am not an expert on Linux or NextCloud, but as I said, I was able to install and let everything work perfectly, including cron (which unfortunately stops working after hours and only returns after 2 server reboots).
If anyone can help, I appreciate it.
(Translation performed by Google)
you’re (probably) missing some stuff in your crontab (i do not know your system, but i guess you’re using the system crontab in /etc/crontab)
you need to add a user and the full path of the prgrams it calls (as cron does not haver the users’ environment).
on my debian install the working line in /etc/crontab looks like this:
*/15 * * * * www-data /usr/bin/php -f /var/www/nc/cron.php
no spaces between * and / in */15; 6th field is the username; after that command with full path.
Thank you for your reply. I understood everything, however, I also tried:
/ 5 * * * * php -f /snap/nextcloud/26119/htdocs/cron.php
/ 5 * * * * php-cli -f /snap/nextcloud/26119/htdocs/cron.php
/ 5 * * * * root -f /snap/nextcloud/26119/htdocs/cron.php
/ 5 * * * * / snap / nextcloud / 26119 / bin / php -f /snap/nextcloud/26119/htdocs/cron.php
/ 5 * * * * / snap / nextcloud / 26119 / php / php -f /snap/nextcloud/26119/htdocs/cron.php
/ 5 * * * * / snap / nextcloud / 26119 / bin / www-data -f /snap/nextcloud/26119/htdocs/cron.php
/ 5 * * * * www-data -f /snap/nextcloud/26119/htdocs/cron.php
/ 5 * * * * root -f / snap / nextcloud / 26119 / bin / php /snap/nextcloud/26119/htdocs/cron.php
And the problem continues. What is intriguing is that it works and after a few hours it stops working and as I said, if you reboot the operating system twice, it will run smoothly again and it will run for hours … then stop running. So, I don’t think there is any error in the cron lines (???), because, if there were, it wasn’t supposed to run at all.
Thanks again. We continue in the fight …
Where did you create these cornjobs? In the crontab of the os, on wich you are running the Snap Package? If so, this will have no effect.
Normally you don’t have to configure anything if you use the snap package. This should already be preconfigured inside the snap package. I would delete your cronjob and if it still doesn’t work, try the following command:
sudo snap set nextcloud nextcloud.cron-interval=5m
Yes, they were created in the user’s cron (crontab -e).
I understood that through SNAP it would not be necessary to manually configure the cron, however, when the NextCloud was installed, the information on the need for configuring the cron (* / 5 * * * * root -f / snap / nextcloud / 26119 / htdocs / cron. php) was requested by NextCloud.
The big mystery is why I set it up on cron, run and stop running … after a long time trying various solutions, I found that with 2 reboots it works again for hours … until it stops again.
Well, I can disable (comment #) in cron and give the command you suggested to see if it will continue to run.
I will return with the status. Thanks.
I’ve tried everything including the command:-
sudo snap set nextcloud nextcloud.cron-interval=5m
And nothing works for me - I am not receiving any notifications either through Email or Push
sorry - i completely missed that you are using snap. I do not use it at all, so i cannot help you with it. it might help to read the doc mentioned by @bb77
Ola, @ bb77, follows the progress of the case:
It took me a long time to answer, because I decided to make the attempt that you proposed to solve the problem as follows:
1 - I removed from the cron the lines that called the cron file every 5 minutes. php;
2 - I waited and watched to see if the update by NextCloud would stop;
3 - It didn’t stop and continued to run perfectly for hours and stayed like that until 30 minutes ago, when I start saying “something seems wrong”;
4 - I gave the command suggested by you and indicated in the link you posted:
sudo snap set nextcloud nextcloud.cron-interval = 5m
5 - I waited 7 minutes (2 more than set for cron to run) and it didn’t. It remained indicated “something seems wrong” …
6 - I rebooted the server to see if it would resolve, that is, it would return indicating that cron.php was executed … just a reboot and the success message was “the task ran seconds ago” …
So, to make sure everything is correct, I must wait a few hours to see if the problem occurs, that is, stop running cron.php.
IMPORTANT NOTE: I removed all lines that refer to running cron.php from crontab … and so it remains …
Thank you … in a few hours, I’ll post the result.
I am following and it is still running … but as it takes many hours to present the problem, I will continue to follow and send the conclusion until the end of the day. Thanks.
You just gave the error. In basic settings of NextCloud / Tasks in the background: “something looks wrong” … “last task ran 23 minutes”.
Unfortunately, I’m sorry … but the problem remains …
After the reboot (this time only 1 reboot) he went back to work. It is working … but the problem remains unsolved … I just found a random solution.
As I said, the problem remains. The solution is to reboot the server … If anyone has any other tips, send them there.
I have the very same problem. Background jobs with cron stops running after a few hours. The only way to start it again is to reboot the server. I use Nextcloud snap 20.0.9 on Ubuntu 20.04 Server.
Update: Problem seems to have solved itself after a long period of daily reboots. Background jobs started working again after Ubuntu 20.04 kernel update 5.4.0-73.