Cron in ISPCONFIG3

Discussion in 'Installation/Configuration' started by ctroyp, Jan 10, 2010.

  1. ctroyp

    ctroyp HowtoForge Supporter

    I have a script that needs to be run daily. Should I use the Cron Job page in ISPCONFIG to do this, or do I need to add it manually on the server, or both?

    In order to test it, I added the following in ISPCONFIG (running at min intervals for testing purpose) :
    Code:
    */5
    *
    *
    *
    *
    wget -q http://www.mydomain.com/cron.php
    
    Another question...should ISPCONFIG create a new file in /etc/cron.d for this new entry? I have seen that it does during other tests, but for some reason, it is no longer creating this file.

    I do not see any new entries in /var/log/ispconfig/cron.log, nor anywhere else, but I do see new entries in syslog. For example in syslog:
    Code:
    Jan 10 10:30:01 server2 /USR/SBIN/CRON[9529]: (web3) CMD (/var/www/clients/client1/web3wget -q http://www.mydomain.com/cron.php)
    
    With the particular script that is running (...cron.php), it should be generating a log file that I have created, but it is not, despite the appearance that it is being logged in syslog.

    Any insight?

    Thanks!
     
  2. ctroyp

    ctroyp HowtoForge Supporter

    Update:
    I now see that a file has been created in /etc/cron.d:
    Code:
    MAILTO=''
    
    SHELL='/usr/sbin/jk_chrootsh'
    
    */5	*	*	*	*	web3	/var/www/clients/client1/web3wget -q http://www.mydomain.com/cron.php
    
    Does this look correct?

    Forgot to mention that the cron job still isn't being executed. And I have also tried:
    Code:
    */5	*	*	*	*	web3    /usr/bin/php /var/www/clients/client1/web3/web/cron.php
     
    Last edited: Jan 10, 2010
  3. till

    till Super Moderator

    You have to use the full path to commands in cronjobs, as cron does not use the $PATH variable. So the correct command will be something like:

    /usr/bin/wget -q http://www.mydomain.com/cron.php
     
  4. ctroyp

    ctroyp HowtoForge Supporter

    Changed to full path, but still, it is not running. :eek:
     
  5. till

    till Super Moderator

    Ok. And how does the crontab looks now? Any errors in the syslog or messages log?
     
  6. ctroyp

    ctroyp HowtoForge Supporter

    I do know that the syslog look to be giving the same entries (with the /usr/bin/wget this time), but I have not looked at the messages log. I don't have access to the system right now, but I'll take a look as soon as I get back...thanks for the help thus far!
     
    Last edited: Jan 11, 2010
  7. ctroyp

    ctroyp HowtoForge Supporter

    No errors or relevant entries in messages or syslog.
     
  8. BorderAmigos

    BorderAmigos New Member

    A side note.... Webmin peacefully coexists with ISPConfig, both can be installed. I set my other cron jobs up in Webmin.
     
  9. ctroyp

    ctroyp HowtoForge Supporter

    I need o get this working with the standard method via ISPConfig. Any other thoughts till? :confused:
     
  10. till

    till Super Moderator

    The cron entrys in the crontab files are fine, so ispconfig is working correctly here as this is all ispconfig has to do, the execution of the cronjob is a question of the operating system. have you tried to restart the cron daemon?
     
  11. ctroyp

    ctroyp HowtoForge Supporter

    Yes, even restarted the server. I just really don't know what else to try.
     
  12. ctroyp

    ctroyp HowtoForge Supporter

    Is it a problem not having a space before the /usr/bin/wget?
    Code:
    */5	*	*	*	*	web3	/var/www/clients/client1/web3/usr/bin/wget -q http://www.mydomain.com/cron.php
     
  13. till

    till Super Moderator

    You have to enter the full path to wget but you entered just wget and not /usr/bin/wget. The missing space above comes from that.
     
  14. ctroyp

    ctroyp HowtoForge Supporter

    So, does this look correct then?
    Code:
    */5	*	*	*	*	web3	/var/www/clients/client1/web3 /usr/bin/wget -q http://www.mydomain.com/cron.php
    
     
  15. ctroyp

    ctroyp HowtoForge Supporter

    Hmm...

    I deleted, then recreated the cron jobs (only 2) and they listed in the ISPConfig interface as expected. Then, a couple hours later, I went in to see if anything was working and noticed two things: 1. The file was not created in /etc/cron.d and 2. There were no longer any cron jobs listed in ISPConfig.

    So...I tried to recreate them once again and I get the following error:
    Code:
    Error
    
       1. The maximum number of allowed cron jobs was reached.
    
    
     
  16. ctroyp

    ctroyp HowtoForge Supporter

    This is strange...

    I went back to the ISPConfig cron jobs page a couple hours later and it is now populated, but the file still does not appear in /etc/cron.d. I have refreshed cache and still no luck. :confused:
     
  17. falko

    falko Super Moderator

    I'm not sure, but shouldn't it read just
    Code:
    */5	*	*	*	*	web3	/usr/bin/wget -q http://www.mydomain.com/cron.php
    (without /var/www/clients/client1/web3)?
     
  18. ctroyp

    ctroyp HowtoForge Supporter

    I recreated everything again and the file was finally created:
    Code:
    MAILTO=''
    
    SHELL='/usr/sbin/jk_chrootsh'
    
    */5	*	*	*	*	web3	/usr/bin/wget -q http://www.mydomain.com/cron.php
    
    ...and it still doesn't appear to be running.
     
  19. till

    till Super Moderator

    You use a chroot enviroment in this cronjob. Are you sure that you installed wget into this path into the chroot?
     
  20. ctroyp

    ctroyp HowtoForge Supporter

    I have wget installed in /var/www/clients/client1/web3/usr/bin.

    :confused::confused:
     

Share This Page