{"id":1023,"date":"2021-10-13T14:57:16","date_gmt":"2021-10-13T14:57:16","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2021\/10\/13\/5646919-how-to-set-up-a-cron-job-with-special-characters-at-hostinger\/"},"modified":"2026-05-08T13:02:27","modified_gmt":"2026-05-08T13:02:27","slug":"5646919-how-to-set-up-a-cron-job-with-special-characters-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/5646919-how-to-set-up-a-cron-job-with-special-characters-at-hostinger\/","title":{"rendered":"How to Set Up a Cron Job With Special Characters at Hostinger"},"content":{"rendered":"<p class=\"no-margin\">If you want to create a cron job without special characters, you can set it up <b><a href=\"\/support\/1583465-how-to-set-up-a-cron-job-at-hostinger\" target=\"_blank\" class=\"intercom-content-link\">via hPanel directly<\/a><\/b>. For cases where the cron job <b>must include special characters<\/b>, such as <code>&gt;\/dev\/null 2&gt;&amp;1<\/code> in them, you will need to create a .sh file and set up a cron job to execute the file. <\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">You can check this <b>video tutorial<\/b> or keep reading to review the process in detail:<\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-h2b-video\">\n<iframe title=\"How to Set Up a Cron Job with Special Characters (Hostinger hPanel)\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/7SQrORQ7k-A?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><hr><p class=\"no-margin\">\n<\/p><h2 id=\"h_58b8df32a6\">Step 1 &ndash; Create a .sh File<\/h2><p class=\"no-margin\">First, you need to create a file that will contain the command. For this, open <b><a href=\"https:\/\/hpanel.hostinger.com\/websites\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">Websites<\/a> &rarr; Manage<\/b>, search for <b>File Manager <\/b>on the sidebar and click on it:<\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2021\/10\/4e4877ea-fb48-46a4-9588-544c51a59e29.jpg\" data-media-id=\"4136\" alt=\"Hostinger hPanel File Manager option highlighted in the File menu\"><\/div><p class=\"no-margin\">Go to the <b>directory <\/b>where you would like to store the file, for instance, the root folder of your website. If you are planning to have several cron jobs, it is recommended to create a separate folder for them.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Once in the desired patch, <b>create a new file<\/b>: <\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">In the next window, enter a name for your file, making sure to use the <b>.sh<\/b> extension, e.g. <b>bash.sh<\/b>. After clicking <b>Create,<\/b> you will be directed to the file editor.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Add the command to your <b>.sh<\/b> file. Here&rsquo;s an example:<\/p><p class=\"no-margin\">\n<\/p><pre><code>#!\/bin\/sh<br>\/usr\/bin\/php \/home\/u123456789\/domains\/example.tld\/public_html\/scripts\/scheduled.php &gt; \/dev\/null 2&gt;&amp;1<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Where: <\/p><ul>\n<li>\n<p class=\"no-margin\"><code>#!\/bin\/sh<\/code> &ndash; indicates that the cron job file is being opened<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><code>\/usr\/bin\/php<\/code> &ndash; loads the PHP libraries (these are required if you are executing a PHP script) <\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><code>\/home\/u123456789\/domains\/example.tld\/public_html\/scripts\/scheduled.php &gt; \/dev\/null 2&gt;&amp;1<\/code> &ndash; the actual command that you want to be executed. Replace the path and filename with the actual file location and name on your hosting<\/p>\n<\/li>\n<\/ul><p class=\"no-margin\">When all is good to go, apply the changes to your file before exiting by clicking on the <b>save icon<\/b>.<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_bc4932a1de\">Step 2 &ndash; Set up a Cron Job<\/h2><p class=\"no-margin\">Now that the file with the command is ready, set up the Cron Job. Open <b><a href=\"https:\/\/hpanel.hostinger.com\/websites\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">Websites<\/a> &rarr; Manage<\/b>, search for <b>Cron Jobs<\/b> on the sidebar and click on it: <\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2021\/10\/23fc7fd8-ac74-4ea4-9f0e-ea27b16a3216.jpg\" alt=\"Hostinger dashboard sidebar with the Cron Jobs menu item highlighted\" data-media-id=\"4137\"><\/div><p class=\"no-margin\">Choose <b>Custom<\/b>, and insert your command like this: <\/p><p class=\"no-margin\">\n<\/p><pre><code>\/bin\/sh \/home\/u123456789\/domains\/example.tld\/public_html\/scripts\/bash.sh<\/code><\/pre><p class=\"no-margin\">Where: <\/p><ul>\n<li>\n<p class=\"no-margin\"><code>\/bin\/sh<\/code> &ndash; indicates to execute a .sh file<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><code>\/home\/u123456789\/domains\/example.tld\/public_html\/scripts\/bash.sh<\/code> &ndash; is the path to the actual .sh file to be executed. As this is an example, ensure to replace it with the actual path to the file corresponding to your hosting<\/p>\n<\/li>\n<\/ul><p class=\"no-margin\">Next, select the schedule<b> <\/b>when the Cron Job will be executed from the <b>Common options<\/b> or add it manually:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">After clicking on <b>Save<\/b>, the custom cron job will be created, and your command with special characters will be executed as scheduled.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><b>Additional resources<\/b>: <\/p><ul>\n<li>\n<p class=\"no-margin\"><b><a href=\"\/support\/4548688-basic-actions-in-file-manager\" target=\"_blank\" class=\"intercom-content-link\">Basic actions in File Manager<\/a><\/b><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><b><a href=\"\/support\/5647075-how-to-check-cron-job-s-output-at-hostinger\" target=\"_blank\" class=\"intercom-content-link\">How to check Cron Job&rsquo;s output at Hostinger<\/a><\/b><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">If you need a custom schedule, you can create it with the help of this tool: <b><a href=\"https:\/\/crontab.guru\/\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">Crontab.guru<\/a><\/b><\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Setting up a cron job with special characters like &gt;\/dev\/null 2&gt;&amp;1 in hPanel<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[229],"tags":[],"class_list":["post-1023","post","type-post","status-publish","format-standard","hentry","category-cron-jobs"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/5646919-how-to-set-up-a-cron-job-with-special-characters-at-hostinger\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/5646919-como-configurar-un-cron-job-con-caracteres-especiales-en-hostinger\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/5646919-comment-configurer-une-tache-cron-avec-des-caracteres-speciaux-chez-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/5646919-bagaimana-cara-setup-cron-job-berkarakter-khusus-di-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/5646919-como-criar-uma-tarefa-cron-com-caracteres-especiais-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/5646919----cron--\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=1023"}],"version-history":[{"count":2,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1023\/revisions"}],"predecessor-version":[{"id":6299,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1023\/revisions\/6299"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}