Cron Issue (Cron isn't working)

Discussion in 'General' started by JamesJamz, Oct 11, 2018.

  1. JamesJamz

    JamesJamz New Member

    Hi All,
    New to ISPConfig, after a long time with WHM and Virtualmin, I fancied a change, and from what I've seen so far with ISPConfig, its really great and lightweight. Although i've found one issue I'm currently having in trying to get a CRON job working that I have set up within ISPC

    Looking in the /var/log/cron file, I can see that the cron job is attampted, but fails with the following error
    CROND[11123]: (CRON) ERROR chdir failed (/var/www/html/sites/): No such file or directory

    Now I'm just trying to run a simple WGET on a URL every */5 - I have also updated the user permission within ISPConfig to be "Full Cron" - but as the error states, that directory doesnt exist, and I'm not sure where its even pulling that location from?
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig has a builtin URL cron, so no need to use wget for that in the command field. Simply put the URL that shall be called periodically starting with http://.... or https://... into the command field of the cronjob.

    The directory in that error message is not used on ISPConfig systems, so I suspect it might be in a script that you copied over from your old server?

    And you can see the resulting cronjob in the /etc/cron.d/ directory, in case you like to see what ISPConfig has written.
  3. JamesJamz

    JamesJamz New Member

    Hi Till,
    Thanks for the reply - I have entered the full correct URL - and I can see the cronjob in /etc/cron.d/ispc_chrooted_web4
    */5    *    *    *    *    web4    wget -q -O- >>/private/cron.log 2>>/private/cron_error.log
    The error i see in var/log/cron seems to relate to the above cronjob, its as if the permissions for the cron user is looking in the wrong dir but I cannot seem to find where its pulling from?

    Safe to say the cron above doesnt seem to run. I'm a little puzzled.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The cron as you entered it can not work for two reasons, Linux cronjobs require it that you call programs with their full path so 'wget' as command can not work, it has to be '/usr/bin/wget' and the above cronjob is jailed, so you probably created it before you switched to full cron.

    But I don't understand why you try to make it so complicated whilte URL cron's are so simple: Edit the cronjob, remove anything that#s in the command field and enter just:

    and press save. See attached screenshot for the exact settings in the UI and that results in this fully working cronjob:

    */5     *       *       *       *       web1    /usr/bin/wget --no-check-certificate --user-agent='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0' -q -t 1 -T 7200 -O /var/www/clients/client0/web1/private/cron_wget.log '' >>/var/www/clients/client0/web1/private/cron.log 2>>/var/www/clients/client0/web1/private/cron_error.log

    Attached Files:

Share This Page