cron configuration

Ask all your questions regarding OC 4.x and older. Please read the Support Forum Rules
Forum rules
Before you post; make sure you are using at least PHP Version 5.3.x - Also read How To Solve Problems By Yourself

cron configuration

Postby roaima » Fri Sep 14, 2012 7:24 pm

In the administration screen, /settings/admin.php, there are three options for cron:
  • AJAX
  • Webcron
  • Cron
I can't find these documented anywhere. Can some kind soul advise me, please, what the different options mean, and which is recommended? I can guess that the last relates to the cron subsystem, but how often should such a cron entry be scheduled, and what command should be run?
roaima
Newbie
 
Posts: 8
Joined: Thu Sep 06, 2012 4:06 pm
ownCloud version: 4.5.0

Re: cron configuration

Postby roaima » Tue Oct 23, 2012 11:55 am

OC 4.5 offers slightly more help on the administration screen, which has enabled me to create the following cron file:

Code: Select all
# /etc/cron.d/owncloud: crontab fragment for owncloud
#
# Run the owncloud scheduler every minute
#
SHELL=/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin

# m h dom mon dow user  command

########################################################################
# Scheduler
#
* * * * *     www-data        php -f /usr/local/app/owncloud/cron.php
roaima
Newbie
 
Posts: 8
Joined: Thu Sep 06, 2012 4:06 pm
ownCloud version: 4.5.0

Re: cron configuration

Postby christophk » Wed Oct 24, 2012 2:08 pm

Hi Roima
Would you mind explaining me what that cron thing actually does?

Would be very much appreciated!

KR, CK
KR, CK

Owncloud 4.5.10 & 5.0.6
Hosted Webspace (Uberspace)
Apache 2.2.15 (CentOS)
PHP 5.4.4
christophk
Starter
 
Posts: 72
Joined: Fri May 25, 2012 10:25 pm

Re: cron configuration

Postby roaima » Wed Oct 24, 2012 9:02 pm

It's pretty standard cron syntax, as described in "man 5 crontab".

The first few lines are either comments (starting with "#") or shell variable definitions. I always specify the SHELL and PATH so that my scripts have a relatively known environment to run under.

The five asterisks on the front correspond to the time values summarised on the line above (minute, hour, day of month, month number, day of week (where Sun=0)). An asterisk means "every possible value", so five asterisks effectively means "every minute".

The next field is the userid under which to run the script (this option is only available in system cron files; if you're running this fragment as an ordinary user you would have to omit this field).

The remainder of the line is the command to be run. Output (stdout and stderr) is sent by email to the userid responsible for running the script.

Chris
roaima
Newbie
 
Posts: 8
Joined: Thu Sep 06, 2012 4:06 pm
ownCloud version: 4.5.0

Re: cron configuration

Postby RandolphCarter » Wed Oct 24, 2012 11:26 pm

What would interest me is what the cron script is good for in the owncloud context. What does it do, which tasks for owncloud need to be executed regularly? Is there any advantage of doing it via cron in comparison to the default AJAX?
RandolphCarter
Inventory
 
Posts: 4004
Joined: Wed May 30, 2012 7:42 am
ownCloud version: 6.0.2
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.5.x

Re: cron configuration

Postby roaima » Thu Oct 25, 2012 3:16 pm

Speaking as another user, rather than a developer, I can only find one thing on my installation using the scheduler. This is the user_ldap extension; every hour it runs off to the LDAP source (Active Directory, in my case) and updates its local cache of user/group accounts.

I don't really see much difference between using cron and ajax, except that the ajax version would only run when people were using the site. My preference for cron is, I think, born out of my long-time Unix/Linux experience; cron *is* the scheduler.
roaima
Newbie
 
Posts: 8
Joined: Thu Sep 06, 2012 4:06 pm
ownCloud version: 4.5.0

Re: cron configuration

Postby RandolphCarter » Thu Oct 25, 2012 4:25 pm

I don't really see much difference between using cron and ajax, except that the ajax version would only run when people were using the site. My preference for cron is, I think, born out of my long-time Unix/Linux experience; cron *is* the scheduler.

Hm but wouldn't that be a good thing - the job only running when it's actually needed? I mean it's not like there's much processing time wasted if it runs once every hour, but still a "lazy" approach seems to have no drawbacks to me.
RandolphCarter
Inventory
 
Posts: 4004
Joined: Wed May 30, 2012 7:42 am
ownCloud version: 6.0.2
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.5.x

Re: cron configuration

Postby roaima » Thu Oct 25, 2012 7:48 pm

In the context I'd be inclined to agree with you
roaima
Newbie
 
Posts: 8
Joined: Thu Sep 06, 2012 4:06 pm
ownCloud version: 4.5.0

Re: cron configuration

Postby rakekniven » Thu Oct 25, 2012 8:44 pm

RandolphCarter wrote:Hm but wouldn't that be a good thing - the job only running when it's actually needed? I mean it's not like there's much processing time wasted if it runs once every hour, but still a "lazy" approach seems to have no drawbacks to me.

OC is no application running as a process. There are no threads like in e.g. C++-apps. For regular tasks like checking for updates you need some function like cron. Using user actions to start cron is not good. If the task takes long time the user has to wait. Better run cron every given period and you are fine.
I use drupal for some websites and there cron is used as well. If user has no cron tasks by provider or similar he has to use "user" cron as well. They call it "poormanscron". Suitable name in my opinion.
Server OS: Linux, web hosting service, no ssh
DB: MySQL 5.1.63
Desktop Client: latest version suitable to server version
Mobile version: iOS stuff
User avatar
rakekniven
Forum Moderator
 
Posts: 1158
Joined: Sun May 06, 2012 2:31 pm
ownCloud version: 6.0.3
Webserver: Apache
Database: MySQL
OS: Linux Hosting Package
PHP version: 5.3.15

Re: cron configuration

Postby RandolphCarter » Thu Oct 25, 2012 9:03 pm

OC is no application running as a process. There are no threads like in e.g. C++-apps. For regular tasks like checking for updates you need some function like cron. Using user actions to start cron is not good. If the task takes long time the user has to wait. Better run cron every given period and you are fine.
I use drupal for some websites and there cron is used as well. If user has no cron tasks by provider or similar he has to use "user" cron as well. They call it "poormanscron". Suitable name in my opinion.


So that means things like scanning for updated files are also done in the cron job? Then in the long run a separate daemon with a file modification listener would be the better solution I guess?
RandolphCarter
Inventory
 
Posts: 4004
Joined: Wed May 30, 2012 7:42 am
ownCloud version: 6.0.2
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.5.x

Next

Return to ownCloud Community Edition 4.x and older

Who is online

Users browsing this forum: No registered users and 15 guests