Cron Jobs, that 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 Hosting → Manage → File Manager (or File Manager beta):
Open the directory where you would like to keep the file. If you plan to have several Cron Jobs, it's recommended to create a separate folder for them.
Once there, 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 update the path to the file
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 Hosting → Manage → Cron Jobs, choose Custom, and insert command like this:
/bin/sh- tells that we are about to execute a .sh file
/home/u123456789/public_html/scripts/bash.sh- a path to an actual .sh file which we want to be executed. Make sure to update the path to the file
Lastly, select the schedule when the Cron Job will be executed and Save the changes.