Sign Up

Browse


Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.


Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

WP Ask

WP Ask Logo WP Ask Logo

WP Ask Navigation

  • Home
  • Recent Questions
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • Questions
    • Recent Questions
  • Communities
  • Polls
  • Home
  • Recent Questions
  • Contact Us
Home/ Questions/Q 424
Next
In Process

WP Ask Latest Questions

gilbertomagnate
  • 7
  • 7
gilbertomagnate
Asked: October 11, 20202020-10-11T11:34:05+08:00 2020-10-11T11:34:05+08:00In: General

How to setup cron job when special characters not allowed by my hosting?

  • 7
  • 7

I am on hostinger and i’m trying to setup cron job for my app integrated with WordPress but i am getting the following error:

Some characters are not allowed for cron job command

cron job issue hostinger

Anybody know to solve such issue? Thanks.

cron jobhostinghostinger
  • 5 5 Answers
  • 748 Views
  • 0 Followers
  • 0
  • Share
    Share
    • Share on Facebook
    • Share on Twitter

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

5 Answers

  • Voted
  • Oldest
  • Recent
  1. aldinlapinig
    aldinlapinig
    2020-10-11T11:39:27+08:00Added an answer on October 11, 2020 at 11:39 am

    Hi, gilbertomagnate!

    In some hosting like hostinger, cron jobs with special symbols in the syntax will require you to make a bash (.sh) file which would support any form of cron job needed.

    A cron job that would execute a bash file looks like this:
    */5 * * * * /bin/sh /path/to/shell/script.sh

    And the bash.sh files contents should look like this example:
    #!/bin/sh/usr/bin/php/home/u234927279/public_html/sendy/scheduled.php > /dev/null 2>&1 cron:run

    The first part #!/bin/sh indicates this is a Bash file that will be opened by the cron.

    The second part loads the php libraries: /usr/bin/php

    The third part is the cron job that otherwise did not work because of the special characters. cron:run executes the cron job inside the file every time the file is opened.

    Once you have created the file with your cronjob in it, simply create a simple cronjob that points to the new .sh file.

    I hope that helps.

      • 2
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
    • leanda
      leanda
      2020-12-27T14:43:03+08:00Replied to answer on December 27, 2020 at 2:43 pm

      Nice. been trying to figure this out this week. one of my sites is on hostinger and we needed to setup cron job for an add-on we use for email marketing. thanks for sharing this solution aldinlapinig. It worked for me.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
      • Mj10
        Mj10
        2021-01-17T07:31:13+08:00Replied to answer on January 17, 2021 at 7:31 am

        Hi.
        Please help out. My project is based on Laravel, hosted on Hostinger.
        Is there any other way I need to write this in my script file? I need to set up a cron job scheduler using laravel.
        #!/bin/sh/usr/bin/php/home/path_to_project && php artisan schedule:run >> /dev/null 2>&1

          • 0
        • Reply
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
          • Share on LinkedIn
          • Share on WhatsApp
        • aldinlapinig
          aldinlapinig
          2021-01-18T18:41:00+08:00Replied to answer on January 18, 2021 at 6:41 pm

          It should be the same process since this will be setup and run in your host / server.

            • 0
          • Reply
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
            • Share on LinkedIn
            • Share on WhatsApp
  2. Charis
    Charis
    2021-03-17T08:13:23+08:00Added an answer on March 17, 2021 at 8:13 am

    this works for me /usr/bin/php/home/path_to_project/artisan schedule:run

      • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp

Sidebar

Most Popular Theme

aalan

Blazing Fast Cloud Hosting

aalan

Explore

  • Home
  • Questions
    • Recent Questions
  • Communities
  • Polls

© 2024 WP Ask. All Rights Reserved.
Powered by Ako.ph.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.