Troubleshoot cronjob

Discussion in 'General' started by Dennis_sp, Aug 24, 2020.

  1. Dennis_sp

    Dennis_sp Member

    I have created a cronjob for a WHMCS install that needs to grab emails from a mailbox and insert them as tickets. I have setup the cronjob through the webpanel under the Sites>Cron jobs menu like this:

    /usr/bin/php -q /var/www/clients/client1/web51/web/crons/pop.php

    Log output is enabled. Where can i check this log?

    Can i run this job on the command line manually to see the output somehow?
    I tried:
    runuser -l web51 -c '/usr/bin/php -q /web/crons/pop.php'
    Site error: the ionCube PHP Loader needs to be installed. This is a widely used PHP extension for running ionCube protected PHP code, website security and malware blocking.

    Please visit get-loader.ioncube.com for install assistance.


    Although ioncube is already installed and working.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Try thange the cronjob to an url, so all you enter into the cronjob command field is the URL like:

    https://yourdomain.tld/crons/pop.php

    This works normally well and is easier to setup and more secure.
     
  3. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    for whmcs you can use this as your cron job:
    Code:
    /usr/bin/php [web_root]/crons/cron.php
    
    and the cron.log and cron_error.log files will be in the /private directory.[/code]
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    This requires that he uses a cronjob without jail or he must have configured his jail to include php though.
     
  5. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    You also get into mixed php version issues, eg. you say ioncube is installed and works, but the error message you receive says it is not; likely you have your website set to one php version (with ioncube) that is different than the system default /usr/bin/php (without ioncube). You can install any php version into your jail, but you'll need to use /usr/bin/php#.# for the binary name, the default "php" name cannot be specified nor does it match your website's configured version currently. Hence a url cron might be easier.
     
  6. Dennis_sp

    Dennis_sp Member

    Thanks for all the prompt replies! For some reason i'm not forum notifications....

    Jesse's reply was very helpful because indeed i installed ioncube for php7.2 so to get the cronjob working i had to use this:
    /usr/bin/php7.2 -q /var/www/clients/client1/web51/web/crons/pop.php

    Also i changed the client1 user to have a cronjob limit (it was blank) and set it to Full cron.
    In the meantime i also found in the manual the logging is done in the private folder.
    However my cronjob is working now but still can't grab email from my mailserver but that isn't ISPconfig related:

    Connection error: POP3 connection broken in response

    edit: I was trying to connect to port 993 which is for IMAP but i had to use 995 for POP3.
     
    Last edited: Aug 24, 2020

Share This Page