Cannot get cron job to work

Discussion in 'Installation/Configuration' started by Niels Terp, Apr 22, 2018.

  1. Niels Terp

    Niels Terp New Member

    Hi, I have been installing Moodle LMS on ISPConfig 3.
    Moodle need to have a cron.php that should be called every minute.
    In the control panel I have created a cron job with a star * in every field, and the command that is executed is
    /usr/bin/php -q /var/www/clients/client1/web1/web/moodle/admin/cli/cron.php
    However, this doesn't work.
    From cron.log:
    søn apr 22 13:20:01 CEST 2018 /usr/bin/fail2ban-client
    søn apr 22 13:20:01 CEST 2018 /sbin/iptables
    søn apr 22 13:20:01 CEST 2018 /sbin/ip6tables
    søn apr 22 13:21:01 CEST 2018
    søn apr 22 13:21:01 CEST 2018
    søn apr 22 13:21:01 CEST 2018 finished.
    søn apr 22 13:22:01 CEST 2018
    søn apr 22 13:22:01 CEST 2018
    søn apr 22 13:22:01 CEST 2018 finished.
    søn apr 22 13:23:01 CEST 2018
    søn apr 22 13:23:01 CEST 2018
    søn apr 22 13:23:01 CEST 2018 finished.
    søn apr 22 13:24:01 CEST 2018
    søn apr 22 13:24:01 CEST 2018
    søn apr 22 13:24:01 CEST 2018 finished.
    søn apr 22 13:25:02 CEST 2018
    søn apr 22 13:25:02 CEST 2018
    søn apr 22 13:25:02 CEST 2018 finished.
    søn apr 22 13:25:02 CEST 2018 c1base1 does not exceed quota qize: -1048576 > 4407296
    søn apr 22 13:25:02 CEST 2018 c1moodle does not exceed quota qize: -1048576 > 10551296
    søn apr 22 13:25:02 CEST 2018 /usr/bin/fail2ban-client
    søn apr 22 13:25:02 CEST 2018 /sbin/iptables
    søn apr 22 13:25:02 CEST 2018 /sbin/ip6tables
    søn apr 22 13:26:01 CEST 2018
    søn apr 22 13:26:01 CEST 2018
    søn apr 22 13:26:01 CEST 2018 finished

    And from syslog:

    Apr 22 13:25:09 webhotel dovecot: imap-login: Disconnected (auth failed, 1 attempts in 6 secs): user=<[email protected]>, method=PLAIN, rip=87.251.221.146, lip=192.168.0.196, session=<EBYmLG5qyP9X+92S>
    Apr 22 13:26:00 webhotel postfix/anvil[4867]: statistics: max connection rate 1/60s for (smtp:91.209.70.221) at Apr 22 13:16:45
    Apr 22 13:26:00 webhotel postfix/anvil[4867]: statistics: max connection count 1 for (smtp:91.209.70.221) at Apr 22 13:16:45
    Apr 22 13:26:00 webhotel postfix/anvil[4867]: statistics: max cache size 1 at Apr 22 13:16:45
    Apr 22 13:26:01 webhotel CRON[5329]: (root) CMD (/usr/local/ispconfig/server/cron.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done)
    Apr 22 13:26:01 webhotel CRON[5330]: (web1) CMD (/usr/bin/php -q /var/www/clients/client1/web1/web/moodle/admin/cli/cron.php >>/private/cron.log 2>>/private/cron_error.log #nielsterp.dk)
    Apr 22 13:26:01 webhotel CRON[5331]: (root) CMD (/usr/local/ispconfig/server/server.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done)
    Apr 22 13:26:01 webhotel CRON[5332]: (www-data) CMD (/usr/bin/php var/www/nielsterp.dk/web/moodle/admin/cli/cron.php >/dev/null)
    Apr 22 13:26:36 webhotel kernel: [37731.621993] [UFW BLOCK] IN=enp3s0 OUT= MAC=c4:54:44:8a:48:b0:d8:c7:71:e7:0a:bf:08:00 SRC=192.210.198.18 DST=192.168.0.196 LEN=52 TOS=0x00 PREC=0x00 TTL=48 ID=0 DF PROTO=UDP SPT=42030 DPT=520 LEN=32
    Apr 22 13:27:01 webhotel CRON[5370]: (root) CMD (/usr/local/ispconfig/server/server.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done)
    Apr 22 13:27:01 webhotel CRON[5371]: (www-data) CMD (/usr/bin/php var/www/nielsterp.dk/web/moodle/admin/cli/cron.php >/dev/null)
    Apr 22 13:27:01 webhotel CRON[5374]: (root) CMD (/usr/local/ispconfig/server/cron.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done)
    Apr 22 13:27:01 webhotel CRON[5376]: (web1) CMD (/usr/bin/php -q /var/www/clients/client1/web1/web/moodle/admin/cli/cron.php >>/private/cron.log 2>>/private/cron_error.log #nielsterp.dk)
    Apr 22 13:27:42 webhotel postfix/smtpd[5399]: connect from unknown[181.214.206.44]
    Apr 22 13:27:44 webhotel postfix/smtpd[5399]: warning: unknown[181.214.206.44]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
    Apr 22 13:27:44 webhotel postfix/smtpd[5399]: disconnect from unknown[181.214.206.44] ehlo=1 auth=0/1 rset=1 quit=1 commands=3/4

    Any suggestions on how to continue ?

    Cheers

    Niels
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Check if this is a jailed cronjob. Ifyes, the either set it to not jailed or you probably have to install PHP in the jail first.
     
  3. madmucho

    madmucho Member

    On ISPConfig i use moodle with cronjob page call,
    That is allowed in moodle setting with preshared password.
    Is configured to run every minute.
    Command to run is: http://pagexyz.tld/admin/cron.php?password=verysecretpassword
    Standart config nothing special.
    Link to oficial page https://docs.moodle.org/24/en/Cron_settings
    Hope thats helps.
     
    till likes this.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    That's the easiest way of course. Did not know that moodle supports it to call the script by http.
     

Share This Page