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