Okay
  Public Ticket #2589084
Error in Cron set up
Closed

Comments

  • Naeem started the conversation

    Greetings!

    I am facing an error in adding the command code for scheduled notification in Cpanel. 

    The error message can be seen in the image attached.

    How can I solved this error and set up Cron job for scheduled notification. 

  • [deleted] replied

    Hello Naeem,

    This may be caused by your server you will need to have separate settings on your hosting provide (cPanel for settings this up).

    Scheduled notifications require a bit of additional configuration with your server cron scheduler. The command that has to be added can be found on the “Notifications” page when notification that requires scheduling is active. You can recognize these notifications by the clock icon next to the notification name. Copy command and paste it in the cron file. The command looks like this:

    */15 * * * * https://yourwebsite.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/notifications/scheduled/send

    You can see the more detailed tutorial how to set up cron at this link.

    If you are not familiar with this you can use plugin WP Crontrol for creating cronjob.

    In the Tools -> Cron Events admin panel, 

    5870820090.png

    click on the “Add PHP Cron Event” tab underneath the cron event table. 

    2764191073.png

    In the form that appears, enter the schedule and next run time in the boxes. The event schedule is how often your event will be executed. In the “PHP code” area, enter the PHP code that should be run when your cron event is executed. Please insert this:

    file_get_contents("https://yourwebsite.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/notifications/scheduled/send");

    You don’t need to provide the PHP opening tag (<?php).

    6717743478.png

    Please replace "https://yourwebsite.com" with your real web address.

    If you don’t see a good interval, then add one in the Settings -> Cron Schedules admin panel or click on link "Manage Cron Schedules". You will find example how you can make custom interval inserting:

    • Interval name
    • Interval(in seconds)
    • Display name
    6861925456.png

    and click "Add Cron Schedules" and it will be added.

    6847038953.png

    When you made custom interval you need to go back to  Tools -> Cron Events admin panel and click on the “Add PHP Cron Event” tab underneath the cron event table where you will insert that custom interval and all other field that are described above. After clicking on "Add PHP Cron Event" it will be added on Event table and you are done.

    8850513929.png

    If you have any confusion about this feel free to ask us, and we will help you.

    Best regards.

  • Naeem replied

    Hi Den!

    I have added command code in the command line. I have added a cron job in Cpanel, but it is still not working... (Image attached in the link)

    https://nimb.ws/kgdzUK

    What could be the reason?

    Can you please consult your tech team and find a final solution.

    I don't want to use the plugin.

    Thank you.

  • [deleted] replied

    Hello Naeem,

    Can you please clarify what exactly is not working? 

    Can you provide the link to your web page where I can book an appointment and test the notification.