{"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-10-15T06:16:54","modified_gmt":"2026-10-15T06:16:54","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\">Setting up a cron job with special characters at Hostinger, such as <code>&gt;\/dev\/null 2&gt;&amp;1<\/code>, requires a .sh file, because the Cron Jobs section in Hostinger dashboard doesn&rsquo;t accept special characters directly. First, create a .sh file containing your command in File Manager. Second, set up a custom cron job that runs the .sh file. Cron jobs without special characters can be created directly in the Cron Jobs section.<\/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 data-click-id=\"hgr-post-content-link-websites\" class=\"intercom-content-link\" href=\"https:\/\/hpanel.hostinger.com\/websites\" target=\"_blank\" rel=\"noopener\">Websites<\/a> &rarr; Dashboard<\/b>, search for <a data-click-id=\"hgr-post-content-link-file-manager\" href=\"https:\/\/www.hostinger.com\/support\/4548688-basic-actions-in-the-file-manager-in-hostinger\/\"><b>File Manager <\/b><\/a>on the sidebar and click on it:<\/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\" alt=\"Hostinger hPanel File Manager option highlighted in the File menu\" data-media-id=\"4136\"><\/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\">Once in the desired patch, <a data-click-id=\"hgr-post-content-link-create-a-new-file\" href=\"https:\/\/www.hostinger.com\/support\/7949267-how-to-use-the-file-editor-at-hostinger\/\"><b>create a new file<\/b><\/a>:<\/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\">Add the command to your <b>.sh<\/b> file. Here&rsquo;s an example:<\/p><pre><code>#!\/bin\/sh\r\n\/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\">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><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, <a data-click-id=\"hgr-post-content-link-set-up-the-cron-job\" href=\"https:\/\/www.hostinger.com\/support\/1583465-how-to-set-up-a-cron-job-at-hostinger\/\">set up the cron job<\/a>. Open <b><a data-click-id=\"hgr-post-content-link-websites-2\" class=\"intercom-content-link\" href=\"https:\/\/hpanel.hostinger.com\/websites\" target=\"_blank\" rel=\"noopener\">Websites<\/a> &rarr; Dashboard<\/b>, search for <b>Cron Jobs<\/b> on the sidebar and click on it:<\/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><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><img decoding=\"async\" class=\"alignnone size-full wp-image-20644\" src=\"https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/10\/2026-10-15_13-16.png\" alt=\"\" width=\"1167\" height=\"524\" srcset=\"https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/10\/2026-10-15_13-16.png 1167w, https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/10\/2026-10-15_13-16-300x135.png 300w, https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/10\/2026-10-15_13-16-1024x460.png 1024w, https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/10\/2026-10-15_13-16-768x345.png 768w\" sizes=\"(max-width: 1167px) 100vw, 1167px\" \/><\/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\"><b>Additional resources<\/b><\/p><ul>\n<li>\n<p class=\"no-margin\"><a data-click-id=\"hgr-post-content-link-how-to-check-the-output-of-a-cron-job-at-hostinger\" href=\"https:\/\/www.hostinger.com\/support\/5647075-how-to-check-the-output-of-a-cron-job-at-hostinger\/\">How to check the output of a cron job at Hostinger<\/a><\/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 data-click-id=\"hgr-post-content-link-crontab-guru\" class=\"intercom-content-link\" href=\"https:\/\/crontab.guru\/\" target=\"_blank\" rel=\"noopener\">Crontab.guru<\/a><\/b><\/p>\n<\/li>\n<\/ul><p class=\"no-margin\">You can check this <b>video tutorial<\/b> or keep reading to review the process in detail:<\/p><div class=\"intercom-h2b-video\">\n<p><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><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Set up a cron job with special characters like &gt;\/dev\/null 2&gt;&amp;1 at Hostinger by creating a .sh file and scheduling it as a custom cron job.<\/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-BR","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-\u044f\u043a-\u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438-\u0437\u0430\u0434\u0430\u0447\u0456-cron-\u0437\u0456-\u0441\u043f\u0435\u0446\u0456\u0430\u043b\u044c\u043d","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":5,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1023\/revisions"}],"predecessor-version":[{"id":20645,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1023\/revisions\/20645"}],"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}]}}