This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Proper CRON setup
#1
Proper CRON setup
kotakomputer Wrote:  For those experience this Cron issue, here are the summaries:



  1. make sure /var/spool/cron owned by apache:apache and permissions 770
  2. make sure /var/spool/cron/apache owned by apache:apache and permissions 660
  3. the correct cron script path is: your_domain_com/CRONFILE.php or your_domain_com/SUBFOLDER/SUBFOLDER/CRONFILE.php
    (Use starting slash CentOS/Ubuntu. No starting slash if using Windows!)


Example for WHMCS Script path is: your_domain_com/admin/cron.php
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#2
RE: [HOW-TO] Proper CRON setup
If arguments need to be passed that do NOT change, simply make a small php file with an include statement like below and call this new cron file instead.

Example new_cron.php:

PHP Code:
<?php
include('path/filename.php?foo=xxx&bar=xxx');
?>
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#3
RE: [HOW-TO] Proper CRON setup
Create a file mycron.php:

Code:
<?php
       // create curl resource
       $ch = curl_init();
     $myurl="my_domain_name/index.php?option=com_easysocial&cron=true&phrase=nottellingyou";

       // set url
       curl_setopt($ch, CURLOPT_URL, $myurl);

       //return the transfer as a string
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

       // $output contains the output string
       $output = curl_exec($ch);

       // close curl resource to free up system resources
       curl_close($ch);      
?>
PHP Docs
http://php.net/manual/en/curl.examples.php
Then create a cron in sentora to run mycron.php.

That would do the trick.

M B
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask

200$ free to start your VPS 60 days credit
Reply
Thanks given by: TGates
#4
RE: [HOW-TO] Proper CRON setup
(01-31-2015, 03:45 AM)Me.B Wrote: you can curl it too in php script with the argument.

Me.B, can you provide an example? I'm sure it would help out a lot.
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#5
RE: [HOW-TO] Proper CRON setup
create a php file that call the include using full http curl path:

http://php.net/manual/en/curl.examples.php

M B
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask

200$ free to start your VPS 60 days credit
Reply
Thanks given by:
#6
RE: [HOW-TO] Proper CRON setup
(01-31-2015, 03:34 AM)TGates Wrote: If arguments need to be passed that do NOT change, simply make a small php file with an include statement like below and call this new cron file instead.

Example new_cron.php:

PHP Code:
<?php
include('path/filename.php?foo=xxx&bar=xxx');
?>

where shud i update this ? can u please guide me thru since i m starter in linux ...
Reply
Thanks given by:
#7
RE: [HOW-TO] Proper CRON setup
(10-16-2017, 12:17 AM)CJsent Wrote: where shud i update this ? can u please guide me thru since i m starter in linux ...

You can put it in the same location as the cron file you want to load.
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#8
RE: Proper CRON setup
I'm not happy with the way I've set up my cron jobs for Boonex Dolphin. Some things are working including bulk mail, but others are not. Dolphin creates sessions which the cron job is meant to clear on a daily basis, but this is not happening.

During the install process, Dolphin asks for the following cron job to be created:

/usr/local/bin/php -q /home/mysite/public_html/periodic/cron.php

I'm not sure how important the -q (quiet) bit is, but the path to PHP has me confused and I'm not sure if I even need it.

During a typical Dolphin install, it attempts to find the PHP binary using the path /usr/local/bin/php. Sometimes it says PHP is found and sometimes it says it isn't. I'm assuming PHP is actually located at /etc/php5/apache2/ and I've tried both paths. In each instance the sessions aren't being cleared and possibly other things probably aren't working properly either.

Can someone help me create a working new_cron.php which is installed correctly in the public_html/periodic folder.

Here's what I've tried:

<?php
include ('/usr/bin/php -q cron.php');
?>

and

<?php
include ('/etc/php5/apache2/php -q cron.php');
?>

and

<?php
include ('-q cron.php');
?>

Thank You
Reply
Thanks given by:
#9
RE: Proper CRON setup
Confused
Why not use Sentora's cron manager? You don't need to call php to run the cron.

If you are using the cron manager, all you need to do is point it at the file you want to run (ie: domain_com/cron/run_daily.php)

So, in your case, you would add a daily cron job and point it at: periodic/cron.php
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#10
RE: Proper CRON setup
I am using Sentora's cron manager, but the path to php supplied by Boonex confused me.

It is actually required every minute so I've set it thus:

periodic/cron.php

with timing set to 1 minute.

Many Thanks.
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Ubuntu: How to setup TLS on postfix and dovecot Diablo925 28 113 ,291 02-15-2018, 08:46 PM
Last Post: duane

Forum Jump:


Users browsing this thread: 1 Guest(s)