Cron Jobs which have special characters (like " >/dev/null 2>&1") in them, cannot be set up via hPanel directly. No worries, it's still possible - all you need to do is to create a .sh file and set up a Cron Job for executing it.
Step 1 - Create a .sh file
First, you need to create a file with your command. For this, open Websites → Manage, search for File Manager on the sidebar and click on it:
Open the directory where you would like to store the file. If you plan on having several Cron Jobs, creating a separate folder for them is recommended.
Once in the File Manager, create a new file:
You can use any name - but the file extension should be
.sh. For example,
Then add the content of your .sh file:
/usr/bin/php /home/u123456789/public_html/scripts/scheduled.php cron:run > /dev/null 2>&1
#!/bin/sh- indicates that the Cron Job file is being opened
/usr/bin/php- loads PHP libraries (required if you are executing a PHP script)
/home/u123456789/public_html/scripts/scheduled.php cron:run > /dev/null 2>&1- an actual command that you want to be executed - make sure to replace the path to the file to the actual file location on your hosting
cron:run- executes the cron job inside the file every time the file is opened
Step 2 - Set up a Cron Job
Now that we have preparations done, just set up a Cron Job. Open Websites → Manage, search for Cron Jobs on the sidebar and click on it:
Choose Custom, and insert your command like this:
/bin/sh- indicates to execute a .sh file
/home/u123456789/public_html/scripts/bash.sh- is the path to the actual .sh file to be executed. This is an example, make sure to use the actual path to the file corresponding to your hosting data
Next, select the schedule when the Cron Job will be executed from the Common options or add it manually:
When it's good to go, click on Save and the custom cron job will be created!