cron job setup

Discussion in 'Installation/Configuration' started by brody182, Jul 18, 2018.

  1. brody182

    brody182 Member

    I created a new site with a sub domain but the cron job does not seem to work
    cron.log is empty
    cron_wget.log is empty

    this is my setup:
    PHP: core:archive --url= > /dev/null
    and if I change the cron job command to this, I get "/bin/bash: /web/console: Permission denied"
    [web_root]/console.php core:archive --url= > /dev/null
    the app I am ruining is matomo analytics

    I have two different sites on this account with two different shell users
    content of file /etc/cron.d/ispc_web7

    */3     *       *       *       *       web7    /usr/bin/wget --no-check-certificate --user-agent='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0' --t 1 -T 7200 -O
    /var/www/clients/client3/web7/private/cron_wget.log ' core:archive --url= > /dev/null' >>/var/www/clients/client3/web7/private/cron.log
    Last edited: Jul 18, 2018
  2. ISPConfig Developer ISPConfig Developer

    the first one probably won't work, the core:archive part and the rest won't be passed as argv to console.php but likely be expanded as very long and invalid filename.

    if you have different users sharing the same file they need to be either in the same group ( client1.... ) or you need to manually add them to a shared group and change the permissions on the file to 770 to allow owner+group execution. Just remember, console.php needs read+write access to filesystem.

    If you use [web_root]/...php to execute it, make sure it actually defines a valid php-exec
    it should have
    #!/usr/bin/env php
    as the first 3 lines.
    if it just starts with <?php
    /usr/bin/php [web_root]/console.php core:archive --....
    Jesse Norell likes this.
  3. brody182

    brody182 Member

    so basically what I have is two websites in the same account and two different shell users for each website

    is this why I'm getting
    /bin/bash: /web/consolePermission denied
    and when I change the file permission to read+write+execute ( 700)
    I get
     /bin/bash: /web/console: /usr/bin/envbad interpreterNo such file or directory 
    ls -l /usr/bin/env
    -rwxr-xr-x 1 root root 31496 Feb 22  2017 /usr/bin/env
    and If I change the cron command to
     [web_root]/console core:archive --url= > /dev/null
    I get this... /etc/cron.d/ispc_chrooted_web7
    Last edited: Jul 19, 2018
  4. brody182

    brody182 Member

    after adding /usr/bin/php I don't get any more error messages, not sure if it's working or not
  5. ISPConfig Developer ISPConfig Developer

    you could add some simple
    <?php echo "I'm done"; ?> somewhere in the code to let it display some text on the screen when run.
    But great you made it :)

Share This Page