Problem with CRON jobs and unexpected folders

Discussion in 'ISPConfig 3 Priority Support' started by ITFixt, Dec 9, 2015.

  1. ITFixt

    ITFixt Member

    1. I have two CRON jobs set up for a particular website but they don't get run.
    These are how they look in Webmin:
    User         Active
    webmm     Yes     php -q /var/www/clients/clientnn/webmm/web/stockmanager/crons/add_new_products.php >/dev/null        
    webmm     Yes     php -q /var/www/clients/clientnn/webmm/web/stockmanager/crons/update_stock_levels.php >/dev/null 
    There is no entry in the ISPC CRON log for them but what I do see there is this:
    Wed Dec 9 12:55:01 CET 2015 FATAL: Module mptctl not found.
    Wed Dec 9 12:55:01 CET 2015 Failed to load mptctl
    Wed Dec 9 12:55:01 CET 2015 sh: -c: line 0: unexpected EOF while looking for matching `"'
    Wed Dec 9 12:55:01 CET 2015 sh: -c: line 1: syntax error: unexpected end of file
    This gets repeated every 5 minutes.
    In Syslog, the only ISPC-related entries are like this:
    Dec  9 13:18:01 svr7 CRON[27363]: (root) CMD (/usr/local/ispconfig/server/ 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done)
    The system CRON log is empty (which I find odd but don't know if this is an artefact of ISPC :} )

    2. There are folders in the "web" folder (i.e. clientnn/webmm folder): bin, dev, etc, lib, lib64, usr, var.
    These are all owned by root. I don't think these have anything to do with ISPC - can anyone confirm this.
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Most likely you craeted tehse cronjobs as jailed cron. a jail is a secure and limited eviroment to execute a crinjob and there is no PHP by default in such a jail, so you can not call the php command from within the jail. Beside that, your cron command has 2 other issues, a command that is used in cron has always to use the full path to a command, so the linuy system can not find php, it has to be /usr/bin/php. And the path to the script is wrong for a jailed cronjob as the / directory of a jail is the website root, so the correct path would be
    /web/stockmanager/crons/add_new_products.php when the cronjob is jailed.

    There are several options to fix this, the easiest one is to use an URL cron instead. Replace the cron command just with the URL to the script, e.g.:


    Another option is to use the correct path to the php program:

    /usr/bin/php /var/www/clients/clientnn/webmm/web/stockmanager/crons/add_new_products.php >/dev/null

    and switch the cron mode to full cron instead of jailed cron.

    The third but most complicated methos is to install PHP into the jail with the jailkit jk_cp command (there ares everal threads in the forum that deal with that topic) and then use the cron command:

    /usr/bin/php /web/stockmanager/crons/add_new_products.php >/dev/null

    for a jailed cronjob.

    This is the jail for the cronjob, so they belong to ISPConfig and are necessary to ensure that the cronjob is executed securely in the website.
  3. ITFixt

    ITFixt Member

    Thanks Till! That's all perfectly clear now. I'd prefer to maintain the added security of the jailkiit, so I'll look into installing PHP in the jail.

    I re-read my post some minutes after reviewing & posting it and only at that point wondered if those folders where part of the jailkit :/ If I'd thought of it before, I could simply have checked in the documentation. Oh well...

    BTW: any thoughts on the CRON error messages in the log? I did manage to find another post concerning such messages but not quite the same thing :/
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Your server seems to have the driver and tools for a LSI raid installed but there is no raid hardware installed. ISPConfig detects the LSI raid driver software mpt-status and queries it for the raid stata and the raid driver fails with the message that you see in the log as the hardware does not exist. You can e.g. find the LSI raid tool:

    which mpt-status

    and then rename it to e.g. mpt-status.bak so that ISPConfig cant find it.
  5. ITFixt

    ITFixt Member

    Thanks again Till!

    I thought it was something of the sort but was puzzling as to why that driver was even there. The server uses Linux software RAID but there is no RAID controller on the Mobo... however, it seems that with Ubuntu, at least one RAID driver has to be installed in order to install some monitoring tool(s) and that's the default one :/

    I eventually decided to use the URL version of the CRON jobs: installing PHP in the jail is not trivial and, worse, meant having to manually keep each virtual server up to date :/ Anyway, it's now all working perfectly and I've learnt some new things.

    I'm still seeing these every 5 minutes in the ISPConfig CRON log:
    Wed Dec 16 23:20:02 CET 2015 sh: -c: line 0: unexpected EOF while looking for matching `"'
    Wed Dec 16 23:20:02 CET 2015 sh: -c: line 1: syntax error: unexpected end of file
    I've looked at every CRON job that runs every 5 minutes & tried to figure out which module this is but, so far, unsuccessfully. I'm wondering if turning on ISPConfig debug for 5 or 10 mins would give any useful information but I'm also slightly worried about turning on debug mode on a production server.
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    You can turn on debug mode, but I'm not sure if it will help in this case, but it might be worth a try. The debug mode is just a verbose logging, so this has no other consequences on the behaviour of a production system. The problem must be a tool that gets called by the monitor.
  7. ITFixt

    ITFixt Member

    Apologies for the delay in replying - and Happy New Year :)
    I still haven't figured out what is causing those error messages but as they seem to be causing no harm, I've given up on that for the moment. When I find some time, I guess I'll have to look at the source of the CRON job to see what tools it calls & then figure out which one is causing the problem.

    I now have a new problem (which is, of course, why I'm back at the forum) but I'm guessing you'd rather have that in a new thread.
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, please make a new thread for a new problem and don't mix topics.

Share This Page