{"id":30732,"date":"2021-02-03T10:48:30","date_gmt":"2021-02-03T02:48:30","guid":{"rendered":"https:\/\/web.mwwsb.com.my\/pjci\/?post_type=kb&#038;p=30732"},"modified":"2022-09-08T21:36:36","modified_gmt":"2022-09-08T13:36:36","slug":"what-do-i-put-for-the-cron-job-command","status":"publish","type":"kb","link":"https:\/\/www.casbay.com\/guide\/kb\/what-do-i-put-for-the-cron-job-command","title":{"rendered":"What Do I Put for the Cron Job Command ?"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"30732\" class=\"elementor elementor-30732\" data-elementor-post-type=\"kb\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-95eb28e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"95eb28e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-409b1bc\" data-id=\"409b1bc\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-201c9de elementor-widget elementor-widget-heading\" data-id=\"201c9de\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">What Do I Put for the Cron Job Command ?<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8420e94 elementor-widget elementor-widget-text-editor\" data-id=\"8420e94\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p class=\"p2\"><span class=\"s1\">The commands below are compatible with all <strong>Linux<\/strong> Web Hosting plan includes <a href=\"https:\/\/www.casbay.com\/business-hosting\">Shared Hosting<\/a>, <a href=\"https:\/\/www.casbay.com\/vps-hosting-malaysia\">VPS Hosting<\/a> and <a href=\"https:\/\/www.casbay.com\/asia-dedicated-server\/malaysia\">Dedicated Servers<\/a> with Easy Apache 3 installed; these commands will not work on Windows Hosting or VPS with Plesk.<\/span><\/p><p class=\"p1\"><span class=\"s1\"><b>Command line examples only! Bold sections must be changed.<\/b><\/span><\/p><p class=\"p2\"><span class=\"s2\"><b>Note:\u00a0<\/b><\/span><span class=\"s1\">You may need to adjust \/home\/ to \/home#\/ depending on the home directory on which your account resides. To view the home directory for your account simply view the stats column on the main cPanel page of your account, and look for the home directory.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9cba161 elementor-widget elementor-widget-heading\" data-id=\"9cba161\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h3 class=\"elementor-heading-title elementor-size-medium\">PHP<\/h3>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2a12066 elementor-widget elementor-widget-text-editor\" data-id=\"2a12066\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"group\"><p><strong>EasyApache 3<\/strong><\/p><p>Command to run a PHP 7.0 cron job:<\/p><pre><code>\/opt\/php70\/bin\/php \/home\/<strong>username<\/strong>\/public_html\/<strong>cron<\/strong><strong>.php<\/strong><\/code><\/pre><\/div><p>Command to run a PHP 5 cron job:<\/p><pre><code>\/php\/home\/<strong>username<\/strong>\/public_html\/<strong>cron<\/strong><strong>.php<\/strong><\/code><code><\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-609529a elementor-widget elementor-widget-text-editor\" data-id=\"609529a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Command to run a PHP 4 cron job:<\/p><pre><code>\/usr\/local\/php4\/bin\/php\/home\/strong&gt;<strong>username<\/strong>\/public_html\/<strong>cron<\/strong><strong>.php<\/strong><\/code><\/pre><p>Optional flags are sometimes required for a PHP cron job:<\/p><pre><code>php -q \/home\/<strong>username<\/strong>\/public_html\/<strong>cron.php<\/strong><\/code><\/pre><p>\u00a0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2db25cc elementor-widget elementor-widget-text-editor\" data-id=\"2db25cc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Command to use a specific php.ini file:<\/p><pre><code>php -c \/home\/<strong>username<\/strong>\/public_html\/php.ini \/home\/<strong>username<\/strong>\/public_html\/<strong>myscript.php<\/strong><\/code><\/pre><p>Command to GET a remote file:<\/p><pre><code>\/usr\/bin\/GET http:\/\/www.<strong>example.com\/file.php<\/strong><\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4f10920 elementor-widget elementor-widget-heading\" data-id=\"4f10920\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h3 class=\"elementor-heading-title elementor-size-medium\">Perl<\/h3>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-406f184 elementor-widget elementor-widget-text-editor\" data-id=\"406f184\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p class=\"p2\"><span class=\"s1\">Command to run a CGI cron job:<\/span><\/p><pre><code>perl \/home\/<strong>username<\/strong>\/public_html\/cgi-bin<strong>\/file.pl<\/strong><\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a0d2f35 elementor-widget elementor-widget-heading\" data-id=\"a0d2f35\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h3 class=\"elementor-heading-title elementor-size-medium\">SSH<\/h3>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5a78477 elementor-widget elementor-widget-text-editor\" data-id=\"5a78477\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Command to run a code script cron job:<\/p><pre><code>\/bin\/sh \/home\/<strong>username<\/strong>\/public_html\/<strong>file.sh<\/strong><\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-487bb96 elementor-widget elementor-widget-heading\" data-id=\"487bb96\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h3 class=\"elementor-heading-title elementor-size-medium\">MySQL<\/h3>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-76a46cc elementor-widget elementor-widget-text-editor\" data-id=\"76a46cc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p><span class=\"s2\"><b>Note:<\/b><\/span><span class=\"s1\">\u00a0It is a good practice to not type your password out in the follow commands but to simply use the -p flag alone and have the system prompt you for the password. This is way your password stays secure and is never on the server as plain text.<\/span><\/p><p>Command to <strong>import<\/strong> a database:<\/p><pre><code>mysql -u <strong>mysql_user<\/strong> -p<strong>password<\/strong> <strong>database_name<\/strong> &lt; <strong>backup.sql<\/strong><\/code><\/pre><p><br \/>Command to <strong>export<\/strong> a database:<\/p><pre><code>mysqldump -u <strong>mysql_user<\/strong> -p<strong>password<\/strong> <strong>database_name<\/strong> &gt; <strong>backup.sql<\/strong><\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-aa2a9b2 elementor-widget elementor-widget-heading\" data-id=\"aa2a9b2\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">How Do I Create and Delete a Cron Job?<\/h3>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1a3b638 elementor-widget elementor-widget-text-editor\" data-id=\"1a3b638\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Cron jobs run scheduled commands at specific times. The Cron Jobs tool in cPanel is helpful for setting up automated maintenance and other unmanned server duties.<\/p><p class=\"p1\"><span class=\"s1\"><b>Create a Cron Job<\/b><\/span><\/p><p class=\"p2\"><span class=\"s2\"><b>1.<\/b><\/span><span class=\"s1\"> Firstly, log into cPanel.<\/span><\/p><p><span class=\"s2\"><b>2.<\/b><\/span><span class=\"s1\">\u00a0Secondly, click <strong>Cron Jobs <\/strong>in the <strong>Advanced<\/strong> section.<\/span><\/p><p><span class=\"s2\"><b>3.<\/b><\/span><span class=\"s1\"> Next, Under <strong>Cron Email<\/strong>, make sure the current email address is valid. If not, enter a new, valid email and click <strong>Update Email<\/strong>. You will receive an email after the cron job has finished.<\/span><\/p><p><span class=\"s2\"><b>4.<\/b><\/span><span class=\"s1\">\u00a0Under <strong>Add New Cron Job<\/strong>, use the <strong>Common Settings<\/strong> drop-down menu to choose from a list of regularly used <strong>intervals<\/strong>; or set the frequency of your cron job by using the drop-down box next to each time unit. Common settings range from <strong>every minute to once a year<\/strong>.<\/span><\/p><p><span class=\"s2\"><b>5.<\/b><\/span><span class=\"s1\"> Then, enter the desired command in the <strong>Command<\/strong> field.<\/span><\/p><p><span class=\"s2\"><b>6.<\/b><\/span><span class=\"s1\"> Lastly, click <strong>Add New Cron Job<\/strong>.<\/span><\/p><p class=\"p2\"><span class=\"s1\">Your cron job will then be execute a file at a certain time, date and repetition, according to the settings you selected.<\/span><\/p><p class=\"p2\"><span class=\"s1\">\u00a0<br \/><\/span><span class=\"s1\"><b>Remove or Edit a Cron Job<\/b><\/span><\/p><p class=\"p2\"><span class=\"s2\"><b>1.<\/b><\/span><span class=\"s1\"> Firstly, click the <strong>Cron Jobs<\/strong> icon in the <strong>Advanced<\/strong> section of cPanel.<\/span><\/p><p><span class=\"s2\"><b>2.<\/b><\/span><span class=\"s1\"> Next, scroll down to the last section called <strong>Current Cron Jobs<\/strong>.<\/span><\/p><p><span class=\"s2\"><b>3.<\/b><\/span><span class=\"s1\"> Then, find the cron job you wish to edit or delete.<\/span><\/p><p><span class=\"s2\"><b>4. <\/b><\/span><span class=\"s1\">Lastly, click either<strong> Edit or Delete <\/strong>under <strong>Actions<\/strong>.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7df20d9 elementor-widget elementor-widget-text-editor\" data-id=\"7df20d9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>We hope this article helped you to learn about Cron Job command. For more articles, please go to <a href=\"https:\/\/www.casbay.com.my\/guide\/\">Knowledge Base<\/a>.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>What Do I Put for the Cron Job Command ? The commands below are compatible with all Linux Web Hosting plan includes Shared Hosting, VPS Hosting and Dedicated Servers with Easy Apache 3 installed; these commands will not work on Windows Hosting or VPS with Plesk. Command line examples only! Bold sections must be changed. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}}},"kbtopic":[117],"kbtag":[106],"mkb_version":[],"_links":{"self":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/30732"}],"collection":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/comments?post=30732"}],"version-history":[{"count":1,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/30732\/revisions"}],"predecessor-version":[{"id":31956,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/30732\/revisions\/31956"}],"wp:attachment":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/media?parent=30732"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=30732"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtag?post=30732"},{"taxonomy":"mkb_version","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/mkb_version?post=30732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}