Unraid, Nextcloud, and what the hell is a Cron?

I set Nextcloud up on my Unraid server a couple of weeks ago and everything seemed to be working fine, and then today I looked and saw this:


Under basic settings I have “cron” selected, but I’ll be honest I have no idea what a CRON even is. Googling it shows some command line solutions, but none of them seem to work in my Unraid docker. Someone please take the time to educate me as to what is going on here. I’m assuming that cron is some sort of a scheduling apparatus to run background tasks.

Also logs. I click on the “logging” tab and it comes back completely blank. I thought I saw a setting in the config.php file that referenced logging, is that what causes the tab in the GUI to populate? Thanks in advance!

OK…so I just switched to “AJAX” and the cron warning went away after a logout/login. I’m guessing that was default and I switched it to CRON after seeing it was recommended, not knowing there was some background shenanigans that needed to be configured first. I still want to figure it out and configure said background shenanigans.
It is still saying that I have over 1600 errors in my logs…which I still don’t know where to view or clear.

1 Like

From the Unraid terminal, I was able to find a handful of log files. Using the CAT command, I was able to see some connection errors and a whole lot of errors about max children needing to be raised. I don’t see anything in the config.php about children. Are they under 18 :rofl::joy::rofl::joy:

I’m guessing that has to do with system resources? I have a 3900X with 64GB of ram, usually with about 30GB free.

→ Let me startpage that for you ←

And then, there is such thing like the manual:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html#cron

Much luck,
ernolf

1 Like

Yes, I read the manual. The commands aren’t working in my Unraid docker, and without proper context it is all jibberish. With some baseline understanding and explanation of the things I don’t understand I could learn a few things to the point that it makes sense. Or I can keep looking at the same pages of Greek until I give up and this community gets one person smaller (but if he’s gonna die he may as well do it, and decrease the surplus population) :unamused:

Unfortunately there are no classes and no one I can pay to take the 15 minutes to explain the things in the manual I don’t understand, so I have to go to forums. I am a truck driver, not an IT professional. I do these things for fun as a hobby, but if this community is just full of people who are going to point me back into the same circle of things I don’t understand like a bunch of elitists, then please let me know and I’ll go back to OneDrive and Google.

I am a truck driver too. I do this for fun as a hobby, like you my friend! :wink:
And yes, I did IT for profession too, but because I love to drive through Europe with a truck much more, thats why we are colleages…

But why do you use unraid? If you want to learn linux, start with a litle server, an old desktop computer and run a Linux like Ubuntu. I had to learn it from scratch too but I do this Hobby since those days, where computeres had a floppy drive and Harddisks where loud and expensive :wink:
There is no alternative for learning the basics other than learning the basics!
Search engines and AI chatbots like ChatGPT are your friends to find the most basic answers.

Much luck,
ernolf

To be fair, I understand that this forum probably gets flooded with morons like me, asking stupid questions. But I only ask the stupid questions, because the answers aren’t as obvious as some people in the industry might think that they are.
I understand that cron has something to do with Linux scheduling. but it is something I have never worked with before and therefor am looking for some baseline understanding. The Level1 forums were very helpful when i had questions about SSH encryption keys…and now I am smarter than I was a couple weeks ago. And that forum post will remain for others who may have the same idiotic questions I once had.
when I from the terminal window I type as it is displayed (and can we all admit that just typing commands that are read from manuals and internet forums without context seem counter-intuitive to security, which is supposed to be an underlying benefit of Linux) “crontab -u www-data -e” I get the error “crontab: unknown user www-data”. So obviously there is a variation within the docker container which requires understanding on my part which is not highlighted within the manual that i can see. Or am I just an idiot?

I used trueNAS (at the time Freenas) with a ZFS pool for years, and made the switch to Unraid because of tutorials from Ed and his YouTube channel “Spaceinvaderone” where he actually takes the time to explain things in a way the FreeNAS forums never did.
My Unraid server works very well, hosting dozens of dockers and several virtual machines and is very stable. I right now only have one issue, and I came to this forum to try and get it sorted…and that is getting Nextcloud working without errors. If this is not the place to get questions answered, then please let me know bluntly.

Hi. Welcome to the wonderfull world of Nextcloud! :slight_smile:

To answer your questions:

CRON is the LINUX/UNIX/BSD deamon for scheduled tasks. Like in WIndows where you have the Task Scheduler.
CRON is in Nextcloud terminology excactly that. In which way do you wish to run the nextcloud background operations that is needed to run frequesntly, in order for Nextcloud to stay working good?

By using system CRON, it means that you in the nextcloud container, needs to setup a cron job on container (OS) level.

By using an external service, you use a webbased service that can execute the background jobs for you by hotting the CRON.php through your webserver, instead of on the host itself.

The AJAX option basically does the same thing as the webbassed, only that it happens from the browser action you do yourself.

The most stable and best option is the first one: System CRON. However it is for some not possibkle to set this up. But if you have access to that - which you do if you run this yourself - this is the way to do it.

The Nextcloud documentation that Ernolf linked to, tells you how you do this in most cases. But it depends on your specific case. Do you use the AIO Docker instance or the NCP?

2 Likes

You said Unraid, right ?
I installed the plugin “User script” in unraid.
Under Unraid settinge click User Scrips


At the bottom click “add new script”
image
On your newly created “user script”
Click gear and then edit script.
And insert the following script, exchange “dockername” with your docker name.

#!/bin/bash
docker exec -u www-data dockername php cron.php

Save close.

Then setup the Schedule to your needs.
Mine is set to every 5 min.
*/5 * * * *

That made cron job work for me.

1 Like

Yes! I’ve worked with user scripts before!

I don’t think that script is doing anything though, so what might I need to change? I tried typing it into a terminal window and got this:
image

Thanks @Kerasit

I think @Thomas_Rasmussen has the right solution, I just need to figure out what my script needs to be.

It looks like some part of the script is wrong.
www.data should be
www-date
ie - not .

I caught that too, but still the same error.
image

I’ve tried user www-data and wwwrun (as is highlighted in the manual) and I still cannot find what user it is supposed to be. I think that is my issue right now.

Here’s something. I think my user might be abc. When I change user from www-data to abc, I get a different error.
image

you might ask the guys at linuxserver what’s up.
If you are using there docker.
[Support] Linuxserver.io - Nextcloud - Docker Containers - Unraid

Ugh, I was afraid of that. I hate using discord :unamused:

Would you recommend I uninstall the Linuxserver docker and instead install the official one?

I guess there is a mod that needs to be installed to get CRON working in the Linuxserver container. Link is here:

I’m not exactly sure how it works…but it does! At least for now :crossed_fingers::crossed_fingers::crossed_fingers:

2 Likes

Great to hear that!

I am not using docker myself. I am a dedicated LXC guy myself. :slight_smile: But I guess that the cron universal mod adds a cronjob through the docker engine instead of directly in the container OS instead. The result is basically the same. Instead of the Container self-contained and by itself executes crontab commands, then the docker engine injects those commands directly on the container CLI console itself, as the user you provides. The result is indifferent and both works.
Personally - and only because my profession is Security (Nextcloud is private and voluntearly for a non-profit organization and has nothing to do with my profession) - I would always prefer to keep it as self-contained as possible, hence I would have setup a crontab inside the container itself. However in a docker context, I also then decentralizes it and make it less…manageable. :slight_smile:
This works for you and if you are comfortable with the docker stack and know how to manage those, then this mod is probably the right solution for you.

1 Like