Cron - shared server (hostinger)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Steve2000
    Junior Member
    • May 2025
    • 6

    #1

    Cron - shared server (hostinger)

    Hi everyone,

    I hope you're all doing well. I'm reaching out because I've been struggling all day to get my cron job to work, but unfortunately, I haven't had any luck.

    I've tried the following command:

    * * * * * cd /home/xxxxxxxxxx/domains/MY-WEBSITE/public_html/SUBDOMAIN; /opt/alt/php83/usr/bin/php -f cron.php > /dev/null 2>&1

    After contacting Hostinger support, I also attempted this alternative:

    * * * * * cd /home/XXXXXXX/domains/MY-WEBSITE/public_html/SUBDOMAIN && /usr/bin/php -f cron.php > /dev/null 2>&1

    Despite my efforts, the cron job still isn't executing as expected. I'm currently on a shared server, so I'm not sure if there are any specific limitations or configurations I need to be aware of. By there way, I have other cron jobs on the server that are working fine using both wget and curl.

    If anyone has any suggestions or insights on what I might be doing wrong, I would greatly appreciate your help!

    Thank you in advance! Steve
  • lazovic
    Super Moderator
    • Jan 2022
    • 1004

    #2
    Hi Steve2000,

    Please check the following thread: https://forum.espocrm.com/forum/gene...on-jobs-errors.

    Comment

    • Steve2000
      Junior Member
      • May 2025
      • 6

      #3
      Unfortunately, I’ve tried just about every approach I can find in EspoCRM forums, and still haven’t been able to get cron running correctly with EspoCRM 9.1.

      Comment

      • lazovic
        Super Moderator
        • Jan 2022
        • 1004

        #4
        Steve2000,

        Please note that if you have two lines to run the EspoCRM cron, the cron will not work. You can also try something like this:

        * * * * * cd /home/XXXXXXX/domains/MY-WEBSITE/public_html/SUBDOMAIN; /usr/bin/php -f cron.php > /dev/null 2>&1

        Comment

        • Steve2000
          Junior Member
          • May 2025
          • 6

          #5
          With the help of Hostinger support, I've tested other cron scripts in the same directory using CLI via the HPanel scheduler, and they run without issue. This suggests the problem is specific to how the EspoCRM script is structured or executed, rather than a general cron or hosting issue.

          Comment

          • lazovic
            Super Moderator
            • Jan 2022
            • 1004

            #6
            Steve2000

            I can assure you that people successfully use EspoCRM on Hostinger and run cron. Perhaps the problem is that you are using sherd hosting, not VPS, because sherd hostings often have various restrictions on running scripts. Try using this command and check the created log file:

            /usr/bin/php /home/u123456789/domains/yourdomain.com/public_html/yoursubdomain/cron.php >> /home/u123456789/domains/yourdomain.com/public_html/yoursubdomain/cron.log 2>&1

            Also check if the corresponding checkbox is marked in the settings of your instance and make sure that the correct permissions and ownership are set for the EspoCRM directory.

            Comment

            • Steve2000
              Junior Member
              • May 2025
              • 6

              #7
              I've been running the following cron command, which successfully creates an empty debug file ... suggesting the cron itself is executing. However, under Administration → Jobs in EspoCRM, all scheduled jobs remain in a pending state and do not appear to be processing:

              /usr/bin/php -d display_errors=1 /XXXX/cron.php > /XXXXX/cron_debug.txt 2>&1

              This seems to confirm that the cron is being triggered, but something within the script is failing silently or not progressing beyond job retrieval.

              Comment

              • lazovic
                Super Moderator
                • Jan 2022
                • 1004

                #8
                Steve2000,

                If the jobs are displayed in the corresponding tab, then the cron has at least been run. Can you please filter them by the Success status?

                Comment

                • Steve2000
                  Junior Member
                  • May 2025
                  • 6

                  #9
                  It worked for approx ten minutes yesterday? but nothing since?

                  Comment

                  • lazovic
                    Super Moderator
                    • Jan 2022
                    • 1004

                    #10
                    Steve2000,

                    It turns out that one of yesterday's commands worked; this is already good news. Try again the commands suggested here: https://forum.espocrm.com/forum/gene...on-jobs-errors.

                    And focus specifically on jobs with the Success status; just refresh the page once a minute after changing the cron line. This way you can find the right command.

                    Comment

                    Working...