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.

Cron Manager doesn't appear to be working in Sentora v1.0.0
#1
Cron Manager doesn't appear to be working in Sentora v1.0.0
So I'm new to Sentora and the last piece of the puzzle I am trying to sort out is getting Cron to run my Drupal update scripts. It's pretty straightforward and I never had issues with cpanel and doing this.

In my website root folders (Drupal), I have a file cron.php which I want to run daily. I have added it to the Sentora Cron Manager but it doesn't seem to actually run the cron.php.

Initially I put in the path as follows:

/sitename_com/cron.php

as instructed on the page with these directions:

"example: /folder/task.php
Note 1 : Script path is relative to your sentora-user root directory:
/var/sentora/hostdata/zadmin/public_html/
Note 2 : Each file access in your script must use absolute directory path as above."

however, it doesn't seem to work, as my site shows that cron has not been run. So then I looked into the file here: /var/spool/cron/crontabs

This is where Sentora puts the www-data file which has all the cron jobs listed. I noticed that there was an extra "/" being put inline.

So the last line of the cron job showed something like this:
/var/sentora/hostdata/zadmin/public_html//mywebsite_com/cron.php

So I think that's wrong. But I followed the directions exactly as told. Anyway, I went back and deleted that cron job from the cron manager and this time, I added the URL as follows:

sitename_com/cron.php

* note I omitted the forward slash at the start of this line.

Now looking at the file at /var/spool/cron/crontabs

it shows the path without the extra forward slash:
/var/sentora/hostdata/zadmin/public_html/mywebsite_com/cron.php

The entire line looks like this:

* * * * * php -d suhosin.executor.func.blacklist="passthru, show_source, shell_exec, system, pcntl_exec, popen, pclose, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, escapeshellcmd, escapeshellarg, exec" -d open_basedir="/var/sentora/hostdata/zadmin/:/var/sentora/temp/" /var/sentora/hostdata/zadmin/public_html/mysite_com/cron.php
# END CRON ID: 8

However, cron is still not running my cron.php file as I can see that cron has not been run when looking at the Drupal status pages. Can someone advise what is going on and what I'm doing wrong? Obviously I can just add a cron task myself in the terminal, but I could prefer to use Sentora to do this. This seems like a bug, but then I'm sure everyone would know it if it truly was a bug. Any ideas???
Reply
Thanks given by:
#2
RE: Cron Manager doesn't appear to be working in Sentora v1.0.0
I forgot to mention...so I have confirmed that cron.php runs and completes successfully if I just copy and paste the php code that is auto created by Sentora...i.e.

php -d suhosin.executor.func.blacklist="passthru, show_source, shell_exec, system, pcntl_exec, popen, pclose, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, escapeshellcmd, escapeshellarg, exec" -d open_basedir="/var/sentora/hostdata/zadmin/:/var/sentora/temp/" /var/sentora/hostdata/zadmin/public_html/mysite_com/cron.php

So that works if I manually paste it into the terminal. So why wouldn't this run succesfully through Sentora and the Cron manager.

Looking at syslog log (tail /var/log/syslog) file I can see this (I just changed a few things to conceal the site's identity):

Apr 12 18:02:01 panel CRON[14857]: (www-data) CMD (php -d suhosin.executor.func.blacklist="passthru, show_source, shell_exec, system, pcntl_exec, popen, pclose, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, escapeshellcmd, escapeshellarg, exec" -d open_basedir="/var/sentora/hostdata/zadmin/:/var/sentora/temp/" /var/sentora/hostdata/zadmin/public_html/sitename_com/cron.php)
Apr 12 18:02:01 panel postfix/pickup[14406]: B3A53142D2C: uid=33 from=<www-data>
Apr 12 18:02:01 panel postfix/cleanup[14500]: B3A53142D2C: message-id=<20150412090201.B3A53142D2C@panel.sitename.com>
Apr 12 18:02:01 panel postfix/qmgr[1062]: B3A53142D2C: from=<www-data@sitename.com>, size=1793, nrcpt=1 (queue active)
Apr 12 18:02:01 panel postfix/qmgr[1062]: warning: connect to transport private/retry: Connection refused
Apr 12 18:02:01 panel postfix/qmgr[1062]: B3A53142D2C: to=<www-data@panel.sitename.com>, orig_to=<www-data>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=4.3.0, status=deferred (mail transport unavailable)


So as you can see the syslog file, it's definitely running that php line which should run the cron.php file. However, it's not being run as there is no record of cron being run on the Drupal site and it shows that the cron job has not been run.

Any ideas why it's not working automatically with the cron job?
Reply
Thanks given by:
#3
RE: Cron Manager doesn't appear to be working in Sentora v1.0.0
There is a report being sent by email and seem your SMTP port is closed/down.

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

10$ free to start your VPS
Reply
Thanks given by:
#4
RE: Cron Manager doesn't appear to be working in Sentora v1.0.0
Hi Me.B...I think you are commenting on the part of the log file that is unrelated to this topic. I just posted a few lines after the CRON entry in the log to show there was nothing else. So please ignore the mail related error stuff as it's unrelated.
Reply
Thanks given by:
#5
RE: Cron Manager doesn't appear to be working in Sentora v1.0.0
So I noticed something else here which may be related to my issue.

I noticed that when I would copy and paste the line of code in cron:
php -d suhosin.executor.func.blacklist="passthru, show_source, shell_exec, system, pcntl_exec, popen, pclose, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, escapeshellcmd, escapeshellarg, exec" -d open_basedir="/var/sentora/hostdata/zadmin/:/var/sentora/temp/" /var/sentora/hostdata/zadmin/public_html/mysite_com/cron.php

while I was inside the directory /var/sentora/hostdata/zadmin/public_html/mysite_com/ it would work just fine.

However if I stepped out of that directory into let's say " /home" and then ran the same line in the terminal it would actually give an error and not run. So it seems this may be my issue. Although I don't understand why it would be an issue as the path is still there, but I think I am getting closer to understanding this. Can someone comment on this?

Here is what happens when I run this line in the terminal OUTSIDE of the directory of the root directory of this website.

php -d suhosin.executor.func.blacklist="passthru, show_source, shell_exec, system, pcntl_exec, popen, pclose, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, escapeshellcmd, escapeshellarg, exec" -d open_basedir="/var/sentora/hostdata/zadmin/:/var/sentora/temp/" /var/sentora/hostdata/zadmin/public_html/mysite_com/cron.php
PHP Warning: include_once(): open_basedir restriction in effect. File(./includes/bootstrap.inc) is not within the allowed path(s): (/var/sentora/hostdata/zadmin/:/var/sentora/temp/) in /var/sentora/hostdata/zadmin/public_html/mysite_com/cron.php on line 8
PHP Warning: include_once(./includes/bootstrap.inc): failed to open stream: Operation not permitted in /var/sentora/hostdata/zadmin/public_html/mysite_com/cron.php on line 8
PHP Warning: include_once(): Failed opening './includes/bootstrap.inc' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/sentora/hostdata/zadmin/public_html/mysite_com/cron.php on line 8
PHP Fatal error: Call to undefined function drupal_bootstrap() in /var/sentora/hostdata/zadmin/public_html/mysite_com/cron.php on line 9
Reply
Thanks given by:
#6
RE: Cron Manager doesn't appear to be working in Sentora v1.0.0
open_basedir restriction in effect. File(./includes/bootstrap.inc)

I think the relative path is the issue. I think this cron was not designed to run in CLI using apache user but more like CPANEL with client user (jailed in own home directory).

Solution would be to setup a manual a cron in linux that will CURL or WGET the file as it will be safe too. I've been thinking since a while we should more offer CURL/WGET cron than CLI cron.

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

10$ free to start your VPS
Reply
Thanks given by:
#7
RE: Cron Manager doesn't appear to be working in Sentora v1.0.0
Ah...THANK YOU! This explains things. Ahhh, I was pulling my hair out trying to figure this out. And yes, I think the cron manager could definitely be improved by offering CURL/WGET functionality as well as the ability to specific the cron run times. Currently you have no way to specific the time of day to run the job. Also I have several websites on this server, so I like to space out the Drupal Cron jobs as they are somewhat CPU intensive for some of my websites, so I don't want them all running at the same time.

But I was trying to stick with using the control panel to do all tasks for this web server, but it seems it's not suitable for my needs.

Thank you for explaining and pointing me in the right direction.

For anyone that comes across this thread, I thought I would post how I ended up solving this in the end. Here is what I did.

1.) First remove all the Cron tasks I added to Cron manager from Sentora's control panel, no need to have them in there, as they won't work.
2.) While logged in as root into my web server I ran:
# crontab -e
3.) now the crontab file for root is open I added the following line to the end of the file:
0 2 * * * wget -O - -q -t 1 http://www.mysite.com/cron.php
4.) Save the file and now you're done.

Change the first 5 characters to suit your needs. This is setup to run every day of the year at 2am.
You can probably use Curl for even simplier code.
0 2 * * * curl -s http://www.mysite.com/cron.php

If you want to make sure it's working you can change the setting to * * * * * so that it runs every minute.

Then run

# tail -f /var/log/syslog | grep CRON

this will show you realtime results of what's being added to the log file. You should see your cron job running and your Drupal site should show that cron was refreshed within the last minute everytime you refresh the status page within Drupal.

Hope this helps someone!
Reply
Thanks given by:
#8
RE: Cron Manager doesn't appear to be working in Sentora v1.0.0
You can use this useful drupal module to create cron: https://wordpress.org/plugins/easycron/.
Reply
Thanks given by:
#9
RE: Cron Manager doesn't appear to be working in Sentora v1.0.0
(05-11-2015, 06:18 PM)Lane Wrote: You can use this useful drupal module to create cron: https://wordpress.org/plugins/easycron/.

I think thats a WordPress Module Angel
My Sentora Resources
[Module] Mail Quota Count | Vagrant Box with Sentora

[Image: vanguardly-logo-micro.png]
Graphic and Web Design. Development.
www.vanguardly.com


Reply
Thanks given by:
#10
RE: Cron Manager doesn't appear to be working in Sentora v1.0.0
(05-11-2015, 06:31 PM)apinto Wrote:
(05-11-2015, 06:18 PM)Lane Wrote: You can use this useful drupal module to create cron: https://wordpress.org/plugins/easycron/.

I think thats a WordPress Module Angel

Sorry, it is https://drupal.org/project/EasyCron.
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Is Sentora dead? rajeevrrs 2 3 ,815 12-17-2022, 09:20 AM
Last Post: TGates
Sentora debug and error files johnnyp 0 1 ,518 10-27-2022, 06:16 PM
Last Post: johnnyp
Transfer Account to another Sentora BenI 1 3 ,213 07-21-2022, 07:19 PM
Last Post: Nigel

Forum Jump:


Users browsing this thread: 1 Guest(s)