{"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-11-06T04:42:30","modified_gmt":"2026-11-06T04:42:30","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\u2019t 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>\n<h2 id=\"h_58b8df32a6\">Step 1 \u2013 Create a .sh file<\/h2>\n<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> \u2192 Manage site<\/b>, search for <a data-click-id=\"hgr-post-content-link-file-manager\" href=\"\/support\/4548688-basic-actions-in-the-file-manager-in-hostinger\/\"><b>File Manager <\/b><\/a>on the sidebar and click on it:<\/p>\n<div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" class=\"alignnone size-full wp-image-24637\" src=\"https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-05_14-17.png\" alt=\"\" width=\"263\" height=\"290\" \/><\/div>\n<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>\n<p class=\"no-margin\">Once in the desired patch, <a data-click-id=\"hgr-post-content-link-create-a-new-file\" href=\"\/support\/7949267-how-to-use-the-file-editor-at-hostinger\/\"><b>create a new file<\/b><\/a>:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-24685\" src=\"https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-05_16-59.png\" alt=\"\" width=\"1572\" height=\"787\" srcset=\"https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-05_16-59.png 1572w, https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-05_16-59-300x150.png 300w, https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-05_16-59-1024x513.png 1024w, https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-05_16-59-768x384.png 768w, https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-05_16-59-1536x769.png 1536w\" sizes=\"(max-width: 1572px) 100vw, 1572px\" \/><\/p>\n<p class=\"no-margin\">Type a name for your file, making sure to use the <strong>.sh<\/strong> extension, e.g. bash.sh. The new file opens in the editor.<\/p>\n<p class=\"no-margin\">Add the command to your <b>.sh<\/b> file. Here\u2019s an example:<\/p>\n<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>\n<p class=\"no-margin\">Where:<\/p>\n<ul>\n<li>\n<p class=\"no-margin\"><code>#!\/bin\/sh<\/code> \u2013 indicates that the cron job file is being opened<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><code>\/usr\/bin\/php<\/code> \u2013 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> \u2013 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>\n<p class=\"no-margin\">When all is good to go, click <strong>Deploy<\/strong> in the top-right corner to make the changes live.<\/p>\n<h2 id=\"h_bc4932a1de\">Step 2 \u2013 Set up a cron job<\/h2>\n<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=\"\/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> \u2192 Manage site<\/b>, search for <b>Cron Jobs<\/b> on the sidebar and click on it:<\/p>\n<div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/55\/2021\/10\/23fc7fd8-ac74-4ea4-9f0e-ea27b16a3216.jpg\/public\" alt=\"Hostinger dashboard sidebar with the Cron Jobs menu item highlighted\" data-media-id=\"4137\" \/><\/div>\n<p class=\"no-margin\">Choose <b>Custom<\/b>, and insert your command like this:<\/p>\n<pre><code>\/bin\/sh \/home\/u123456789\/domains\/example.tld\/public_html\/scripts\/bash.sh<\/code><\/pre>\n<p class=\"no-margin\">Where:<\/p>\n<ul>\n<li>\n<p class=\"no-margin\"><code>\/bin\/sh<\/code> \u2013 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> \u2013 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>\n<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>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-20644\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/55\/2026\/10\/2026-10-15_13-16.png\/public\" alt=\"\" width=\"1167\" height=\"524\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/55\/2026\/10\/2026-10-15_13-16.png\/w=1167,fit=scale-down 1167w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/55\/2026\/10\/2026-10-15_13-16.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/55\/2026\/10\/2026-10-15_13-16.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/55\/2026\/10\/2026-10-15_13-16.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1167px) 100vw, 1167px\" \/><\/p>\n<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>\n<p class=\"no-margin\"><b>Additional resources<\/b><\/p>\n<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=\"\/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>\n<p class=\"no-margin\">You can check this <b>video tutorial<\/b> or keep reading to review the process in detail:<\/p>\n<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":{"_content_updated_date":"","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":8,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1023\/revisions"}],"predecessor-version":[{"id":24738,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1023\/revisions\/24738"}],"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}]}}