#1  
Old 30th March 2012, 19:23
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,149
Thanks: 4
Thanked 56 Times in 52 Posts
Default Cronjob troubles

Hmmm, I tried to set a cron from ISPC but it does not seem to be run.

Here are the settings:



The content of the shell script is this:

Code:
root@manager /var/www/clients/client1/web9/web/urteile # cat /var/www/clients/client1/web9/web/urteile/cron.sh 
#!/bin/bash

curPath="/var/www/clients/client1/web9/web/urteile";

php -f ${curPath}/bger_inital.php
php -f ${curPath}/bverwg_inital.php
php -f ${curPath}/bstger_inital.php
php -f ${curPath}/sg_inital.php
php -f ${curPath}/fr_inital.php
php -f ${curPath}/email.php
php -f ${curPath}/email_bverwger.php
php -f ${curPath}/email_bstger.php
php -f ${curPath}/email_sg.php
php -f ${curPath}/email_fr.php
Running the shell script from the terminal works fine but cron doesn't run it.
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
Sponsored Links
  #2  
Old 31st March 2012, 12:59
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Can you use the full path to the php binary in the script?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 31st March 2012, 17:07
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,613 Times in 4,424 Posts
Default

If this is a jailed cronjob, then the ath to the script is /web/urteile/cron.sh and in the jail, php cli is most likely not available.

By the way, doing this as url cron would be much easier, url cron means that you run a httprequest by entering just the url in the cron command field:

http://www.yourdomain.tld/web/urteile/cron.php

and in the cron.php you add the other php files as includes or as url fopen.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #4  
Old 31st March 2012, 17:31
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,149
Thanks: 4
Thanked 56 Times in 52 Posts
Default

I try now using full path to the php binary.

There's no cron.php but a bash script "cron.sh". it should be working from the command line. When running it in the shell it should work. I plan on moving those files outside the web dir anyway.
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
  #5  
Old 3rd April 2012, 13:48
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,149
Thanks: 4
Thanked 56 Times in 52 Posts
Default

I altered the cron.sh file to this:

Code:
#!/bin/bash

main_function
{

        curPath="/var/www/clients/client1/web9/web/urteile";

        /usr/bin/php -f ${curPath}/bger_inital.php
        /usr/bin/php -f ${curPath}/bverwg_inital.php
        /usr/bin/php -f ${curPath}/bstger_inital.php
        /usr/bin/php -f ${curPath}/sg_inital.php
        /usr/bin/php -f ${curPath}/fr_inital.php
        /usr/bin/php -f ${curPath}/email.php
        /usr/bin/php -f ${curPath}/email_bverwger.php
        /usr/bin/php -f ${curPath}/email_bstger.php
        /usr/bin/php -f ${curPath}/email_sg.php
        /usr/bin/php -f /var/www/web1/html/urteile/email_fr.php

}

if [ -z $TERM ]
then
        # if not run via terminal, log everything into a log file
        main_function 2>&1 >> /var/www/clients/client1/web9/web/urteile/cron.log
else
        # run via terminal, only output to screen
        main_function
fi
That should make a cron.log file when the script is called by cron. However, the script should have been called meanwhile but no .log file was created. So, cron doesn't run that script.
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
  #6  
Old 3rd April 2012, 13:54
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,613 Times in 4,424 Posts
Default

Please see my comments on paths in #3.If this is a jailed cronjob, then none of the paths (neither curPath nor the log path) exist from the view of the cronjob as the root of the jail is /var/www/clients/client1/web9/, so you have to use paths the are relative to that dir inside the script like:

/web/urteile/cron.log

instead of:

/var/www/clients/client1/web9/web/urteile/cron.log

You can see if the cronjob is jailed or not in the cron file in /etc/cron.d/

Beside that. there is no php binary available in the jail, so you cant call php then (see #3).
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #7  
Old 3rd April 2012, 13:56
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,149
Thanks: 4
Thanked 56 Times in 52 Posts
Default

till:

ok, it is jailed. How to unjail it?
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
  #8  
Old 3rd April 2012, 14:12
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,613 Times in 4,424 Posts
Default

Change the shell in the cronjob config file in /etc/cron.d/ to /bin/bash and ensure that you allow unjailed cronjobs for this client and change the cron type to unjailed cron in the cronjob settings.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #9  
Old 3rd April 2012, 14:20
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,149
Thanks: 4
Thanked 56 Times in 52 Posts
Default

actually I did now cancel the "jail" line. but my question was rather aimed at how to permanently disable the jailing of crons.

(At the same time I'd also like to know how to enable the shell for the websites by default)
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
  #10  
Old 3rd April 2012, 14:42
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,613 Times in 4,424 Posts
 
Default

Quote:
but my question was rather aimed at how to permanently disable the jailing of crons.
Thats what I explained you above in #8:

.... and ensure that you allow unjailed cronjobs for this client and change the cron type to unjailed cron in the cronjob settings.

PLease be aware that unjailed cronjobs can be a real security problem if you allow clients access to them. I explained you in #3 how to implement your cronjob in a secure way as html cronjonb as a .sh file is not required when you use it just to call a few php files.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.

Last edited by till; 3rd April 2012 at 14:45.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cronjob not working icinfo General 11 19th August 2011 15:29
ISPConfig cronjob not working why? ph-tvs Installation/Configuration 3 22nd February 2011 18:29
email troubles kwickcut Installation/Configuration 3 14th February 2011 20:13
cronjob not working vogelor General 1 9th October 2009 13:05
SAMBA PDC + Debian Lenny with LDAP backend troubles richardnixonshead Server Operation 0 9th September 2009 01:35


All times are GMT +2. The time now is 07:58.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.