Announcement

Collapse
No announcement yet.

Cron jobs - Scheduled jobs are not running

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cron jobs - Scheduled jobs are not running

    Hello. I would appreciate any advice. I'm hosting EspoCRM on Hostinger and following their instructions on setting up a cron job with special characters.

    I get the following line to add to the crontab file to run Espo Scheduled Jobs:
    * * * * * cd /home/u23731xxxx/domains/xxxxxxxxxx.com/public_html/crm; /opt/alt/php81/usr/bin/php -f cron.php > /dev/null 2>&1
    When I create.sh file and add the text above (I tried with and without * * * * * cd) and create a corn job, I get the error: Line 2: is a directory
    I tried a few other options so it points to the file and not just the directory (e.g.,/home/u23731xxxx/domains/xxxxxxxxxx.com/public_html/crm/bash.sh, etc.). And results are still negative.

    So what am I doing wrong? I would greatly appreciate any help or hints.​

  • #2
    Hi,


    it's in french, but you need to do there. not bash.sh file or anything else.
    i think you need add just this part :

    crm/cron.php > /dev/null 2>&1

    and set the other setting to
    all minutes
    all hours
    ....

    EDIT
    Haaa Sorry,


    Hope someone can help ..
    Last edited by item; 05-10-2023, 08:15 PM.

    Comment


    • #3
      Hi there!

      Thanks a lot for the prompt assistance. The second link actually helped! Well, I do believe so. At least it doesn't show the "Scheduled jobs are not running" error anymore. In case anyone ever needs it too, I had to create .sh file anyways, but instead of the code provided in the EspoCRM admin panel, the following format went into the file:

      #!/bin/sh
      /usr/bin/php /home/uxxxxxxxxx/domains/xxxxxxxxx.com/public_html/crm/cron.php > /dev/null 2>&1


      Once again,​ thanks a lot!

      Originally posted by item View Post
      Hi,


      it's in french, but you need to do there. not bash.sh file or anything else.
      i think you need add just this part :

      crm/cron.php > /dev/null 2>&1

      and set the other setting to
      all minutes
      all hours
      ....

      EDIT
      Haaa Sorry,


      Hope someone can help ..

      Comment


      • RanDee
        RanDee commented
        Editing a comment
        Hi, I have the same issue. I have tried your format of the script.sh file under the public_html folder but the error " Scheduled jobs are not running" still exists.
        May I know what option did you choose, PHP or custom? then what did you input in the "command to run" field? - thanks for the help

      • rabii
        rabii commented
        Editing a comment
        you need to do it as custom because you are invoking other params. should be something like (* * * * * /bin/sh /home/your-id-here/domains/your-domain-here/public_html/script.sh)

      • RanDee
        RanDee commented
        Editing a comment
        Thanks Rabii, I have tried your suggestion but it doesn't seem to work on me.

        .sh file>

        #!/bin/sh
        /usr/bin/php /home/uxxxxxxxxx/domains/lxxxxxxxx.com/public_html/crm/cron.php > /dev/null 2>&1

        command to run file>

        *****/bin/sh home/uxxxxxxxxx/domains/xxxxxxxx.com/public_html/script.sh

    • #4
      Thanks Rabii, I have tried your suggestion but it doesn't seem to work on me.

      .sh file>

      #!/bin/sh
      /usr/bin/php /home/uxxxxxxxxx/domains/lxxxxxxxx.com/public_html/crm/cron.php > /dev/null 2>&1

      command to run file>

      *****/bin/sh home/uxxxxxxxxx/domains/xxxxxxxx.com/public_html/script.sh​​

      Comment


      • #5
        Here is what is working for:

        i have the .sh in a folder named script (file name is espo.sh) content of the file below: (note that my instance is installed under a subdomain app) - my main domain is using php8.1

        PHP Code:
        #!/bin/sh
        cd /home/uxxxxxxxx/domains/mydomain.co.uk/public_html/app; /opt/alt/php81/usr/bin/php -f cron.php > /dev/null 2>&1​ 

        Command to run file (Please note that you have to have / before home)

        PHP Code:
        * * * * * /bin/sh /home/uxxxxxxxxx/domains/mydomain.co.uk/public_html/scripts/espo.sh  ​ 

        This set up above is working fine for my instance.
        Rabii
        Web Dev

        Comment


        • RanDee
          RanDee commented
          Editing a comment
          Thanks Rabii... This format worked!

        • rabii
          rabii commented
          Editing a comment
          you are welcome

      • #6
        I just changed the command in crontab without making a .sh file. This is what I added:
        PHP Code:
        * * * * * cd /home/user/domains/domain.tld/public_html; /usr/bin/php8.3 -f cron.php > /dev/null 2>&

        Comment


        • #7
          It seems like the issue might be with how you're specifying the path to the cron job script. Ensure that you're providing the correct path to the script in your cron job command. Instead of just specifying the directory, include the full path to the script file itself. For example:

          ```
          * * * * * /full/path/to/your/script.sh
          ```

          Replace "/full/path/to/your/script.sh" with the actual path to your script file. This should resolve the "Line 2: is a directory" error.​

          Comment

          Working...
          X