Sign Up


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 question.


Forgot Password?

Need An Account, Sign Up Here
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
In Process
gilbertomagnate
gilbertomagnate

gilbertomagnate

  • 1 Question
  • 0 Answers
  • 0 Best Answers
  • 26 Points
View Profile
  • 6
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?

  • 6

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
  • 4 4 Answers
  • 18 Views
  • 0 Followers
  • 0
  • Share
    Share
    • Share on Facebook
    • Share on Twitter

4 Answers

  • Voted
  • Oldest
  • Recent
  1. aldinlapinig

    aldinlapinig

    • 0 Questions
    • 25 Answers
    • 7 Best Answers
    • 138 Points
    View Profile
    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

      • 1 Question
      • 1 Answer
      • 0 Best Answers
      • 25 Points
      View Profile
      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
        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

        • 1
        • Reply
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
          • Share on LinkedIn
          • Share on WhatsApp
        • aldinlapinig

          aldinlapinig

          • 0 Questions
          • 25 Answers
          • 7 Best Answers
          • 138 Points
          View Profile
          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
Leave an answer

Leave an answer
Cancel reply

Browse

Choose from here the video type.

Put Video ID here: https://www.youtube.com/watch?v=sdUUx5FdySs Ex: "sdUUx5FdySs".


Sidebar

Blazing Fast Cloud Hosting

Adv

Most Popular Theme

Adv

Explore

  • Home
  • Questions
    • Recent Questions
  • Communities
  • Polls

© 2020 WP Ask. All Rights Reserved.
Powered by WP Superhero.

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.