Server reboot every 12 hours.

Hello!

I have Nextcloud installed, version Nextcloud Hub 10 (31.0.5)
Debian12
Coddy

I have the following problem, when including lines in crontab
*/5 * * * * php -f /home/waw555/www/nextcloud/cron.php
0 5 * * * php /home/waw555/www/nextcloud/occ preview:pre-generate

My server reboots every 12 hours exactly at 6am and 6pm.

If these lines are commented out, then the server reboot is disabled.

How can I remove the server reboot every 12 hours without disabling cron?

I see no connection between the cron jobs and the restart.

You could deactivate the cron jobs and run them manually. What happens? How long do they run?

php -f /home/waw555/www/nextcloud/cron.php

php /home/waw555/www/nextcloud/occ preview:pre-generate

1 Like

Is it a clean reboot or a crash? Check your journalctl output and/or /var/log output.

You might also check your Nextcloud log (possibly adjusting the log_level temporarily) to see what’s going on around that time frame. Instructions are in the support template you appear to have overlooked. Querying the jobs that ran via occ background-job:list might also turn something up.

1 Like

Hi!
I ran each command and it completed in about 40 seconds.

I also started an experiment by turning on the above lines separately, and if you turn on the lines one by one, then the uptime is more than a day, but if you turn them on together, then the uptime is again 12 hours, the reboot occurs exactly at 6 am and at 6 pm. I can’t find the reason for the reboot yet.

There is nothing in the logs during the reboot, as if the machine turns off as if you turned off the power.

Hi,

php /home/waw555/www/nextcloud/occ preview:pre-generate on the commandline should generate an error like:

Not enough arguments (missing: “file”).

What is your aim with this command? You might execute it properly in the CLI and then add it to your cron?

Nope, you’re mixing pre-generate (from GitHub - nextcloud/previewgenerator: Nextcloud app to do preview generation in the background.) with the core generate command :slight_smile:

Sorry :sweat_smile:

And you have the memory_limit issue, in the php.ini, in the documentation checked?

One cronjob runs every 5 mins. The other one just at 5 am. But your system crashes at 6 am, and 6 pm. 6 am your local time could be 5 am on the server (daylight saving time?), but there is no reason it makes the server reboot at 6 pm.

You could run the second cronjob at:
17 5 * * * php /home/waw555/www/nextcloud/occ preview:pre-generate

so it runs at 5:17 am, so after your regular cronjob, and at a very specific time (in case you still have reboots).

1 Like

The following will show you the last part of your system logs from the prior boot:

sudo journalctl -a --boot=-1 | tail -50

You can see prior boots like this:

sudo journalctl --list-boots

You can gain some insights into things this way.

If there is no indication of a shutdown/suspend/etc and your host is just going offline suddenly, it may be a hardware matter.

This is what sudo journalctl --list-boots looks like before I started disabling cron to find the cause

 -49 59a6f1ee2b3a4d1e8b4d7e0a39282d1e Sun 2025-03-09 06:01:25 +05 Mon 2025-03-10 06:00:01 +05
 -48 0f96a8c1f2f840ac944a8e48e41b9001 Mon 2025-03-10 06:01:27 +05 Tue 2025-03-11 06:00:01 +05
 -47 11371a02efa3401db2d5b191e64e2e3a Tue 2025-03-11 06:01:26 +05 Wed 2025-03-12 06:00:31 +05
 -46 9e9e50b928e44647a4f81003f6f29e7a Wed 2025-03-12 06:01:25 +05 Thu 2025-03-13 06:00:03 +05
 -45 16f49efe0b7644e28f06d3389030c8f0 Thu 2025-03-13 06:01:26 +05 Fri 2025-03-14 06:00:01 +05
 -44 4e3fed675c934e4c91c03b6cb8597a77 Fri 2025-03-14 06:01:20 +05 Sat 2025-03-15 06:00:05 +05
 -43 5681351149ca4dbdb4a4700ee16b5931 Sat 2025-03-15 06:01:32 +05 Sun 2025-03-16 06:00:11 +05
 -42 d99588c9e58847ffbc9c1b5960f46d00 Sun 2025-03-16 06:01:26 +05 Mon 2025-03-17 06:00:01 +05
 -41 3a9d1e8fff9e4aeb890d4128655f7d4f Mon 2025-03-17 06:01:25 +05 Tue 2025-03-18 06:00:01 +05
 -40 02c1e03a9e0547cfb6a9c16c4f408414 Tue 2025-03-18 06:01:27 +05 Wed 2025-03-19 06:00:01 +05
 -39 093df882e49d49ac897f04b4f836317a Wed 2025-03-19 06:01:25 +05 Thu 2025-03-20 06:00:18 +05
 -38 b7b51f4e07384fad8a50a51b152bb4b2 Thu 2025-03-20 06:01:22 +05 Fri 2025-03-21 06:00:05 +05
 -37 a8c379c0b7b54190b104bf544f0071f7 Fri 2025-03-21 06:01:26 +05 Sat 2025-03-22 06:00:01 +05
 -36 9059fbaceba840a994ecd611d4482173 Sat 2025-03-22 06:01:28 +05 Sun 2025-03-23 06:00:01 +05
 -35 13c4144c5c6a4e3287231ebb9dbc743c Sun 2025-03-23 06:01:27 +05 Mon 2025-03-24 06:00:01 +05
 -34 2d9aa238c7c6483c8f3afbb1bbd5e803 Mon 2025-03-24 06:01:26 +05 Tue 2025-03-25 06:00:02 +05
 -33 9ee9ffbe8350410486ace8694b31e2b2 Tue 2025-03-25 06:01:28 +05 Wed 2025-03-26 06:00:08 +05
 -32 d78d0bd17d544398ae108005d665ac1e Wed 2025-03-26 06:01:27 +05 Thu 2025-03-27 06:00:01 +05
 -31 fe07f64e3af34b89af2ea73803f0cca9 Thu 2025-03-27 06:01:27 +05 Fri 2025-03-28 06:00:01 +05
 -30 a78415b2746148aca6975246d18ec0f7 Fri 2025-03-28 06:01:28 +05 Sat 2025-03-29 06:00:11 +05
 -29 e9153a79305d4f41bb83b9ed4e2d2912 Sat 2025-03-29 06:01:27 +05 Sun 2025-03-30 06:00:01 +05
 -28 180dabb3a316421bb9875fa579df3f2e Sun 2025-03-30 06:01:28 +05 Mon 2025-03-31 06:00:25 +05

sudo journalctl -a --boot=-1 | tail -50

> мая 24 06:00:20 SERVER NetworkManager[719]: <info>  [1748048420.1236] device (vnet3): state change: unavailable -> disconnected (reason 'user-requested', sys-iface-state: 'managed')
> мая 24 06:00:20 SERVER NetworkManager[719]: <info>  [1748048420.1245] device (vnet3): Activation: starting connection 'vnet3' (6994fd04-247b-4182-90b3-603d39a7daa8)
> мая 24 06:00:20 SERVER NetworkManager[719]: <info>  [1748048420.1247] device (vnet3): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
> мая 24 06:00:20 SERVER NetworkManager[719]: <info>  [1748048420.1250] device (vnet3): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
> мая 24 06:00:20 SERVER NetworkManager[719]: <info>  [1748048420.1253] device (vnet3): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')