Announcement

Collapse
No announcement yet.

Setting up Crontab with cPanel

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

  • Setting up Crontab with cPanel

    Hi,

    I am setting up the cron job for Espo on cpanel and I am getting this error:

    Please help!

  • #2
    In the screenshot i can not see the the cron command. Is should be 'cron.php' or 'cron.php > /dev/null'(if you don't want to be notified when the cron has run.

    Good luck

    Comment


    • #3
      * * * * * - scheduling rules for cron running. You set it in prev inputs. (remove * * * * * from command input)

      Comment


      • #4
        Thanks, Tanya. I did like this I removed *****, added this line cd /home/mydomain/public_html/espo; /usr/local/bin/php -f cron.php > /dev/null 2>&1 at the url place, I checked the server logs, it works, but nothing happens in Espocrm. Please check attached images. What could be wrong? many thanks

        Click image for larger version  Name:	cron task.png Views:	1 Size:	36.6 KB ID:	31075Click image for larger version  Name:	Schedules jobs.png Views:	1 Size:	36.3 KB ID:	31073Click image for larger version  Name:	server logs.png Views:	1 Size:	99.1 KB ID:	31074
        Save
        Save
        Save
        Save
        Save
        Last edited by sarunijus; 09-15-2017, 09:29 AM.

        Comment


        • #5
          Check espocrm log (data/logs), also you could check job table in database (does it have a job with status Running?).

          Comment


          • #6
            I checked job table in database, the status is pending. What should I do with it?

            Comment


            • #7
              I think, you have to remove the "cronurl" command. The full command is:
              Code:
              cd /home/maydomain/public_html/espo; /usr/local/bin/php -f cron.php > /dev/null 2>&1
              The cron should be run as cli, not via HTTP GET request.
              Job Offers and Requests

              Comment


              • #8
                Thanks, Taras. Well, I did, but still nothing. My main problem is, that I'm not getting emails, because cron job doesn't work.

                Comment


                • #9
                  I think, It doesn't work because your cron sends requests via HTTP. Please try to comment this line (#33) in <espocrm-directory>/cron.php:
                  PHP Code:
                  //   die("Cron can be run only via CLI"); 
                  Then, set in cPanel the URL in a format:
                  Code:
                  http://<YOUR_URL>
                  Job Offers and Requests

                  Comment


                  • #10
                    Ok, so I pasted // die("Cron can be run only via CLI"); ( attached image), then I created another cron task with url (attached image)( actually I tired with 'cron url' and left without. Still nothing. Any more ideas? many thanks.

                    Click image for larger version  Name:	cron task.png Views:	1 Size:	37.3 KB ID:	31092
                    Save
                    Last edited by sarunijus; 09-15-2017, 09:35 AM.

                    Comment


                    • #11
                      delete last row from file.....

                      Comment


                      • #12
                        Thanks, just deleted.

                        Comment


                        • #13
                          Hi tanya and tarasm, Thank you very much guys for your help. Now it works. The issue was, that cron sent requests via HTTP, I made changes as you said, addedd // in line #33, but my url had to be this in cpanel:
                          cronurl 'http://my domain.espo/cron.php'
                          now everything works like a charm.
                          Yesterday I've already lost a hope to fix it, and boom, it works . I really appreciate your help. I spend much time reading forum posts to solve the problem. but only here I found real help.
                          . You're amazing.
                          Save
                          Last edited by sarunijus; 09-15-2017, 09:23 AM.

                          Comment


                          • #14
                            You're welcome But I have to notify you, it's not secure, that this url is available for all and everyone can run your cron.... Create at least any parameter with some data, pass it in cpanel and check it in file
                            Last edited by tanya; 09-15-2017, 09:29 AM.

                            Comment


                            • #15
                              Ok thanks, removed it

                              Comment

                              Working...
                              X