{"id":2789,"date":"2020-05-12T16:54:40","date_gmt":"2020-05-12T15:54:40","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=2789"},"modified":"2022-02-17T07:13:48","modified_gmt":"2022-02-17T07:13:48","slug":"creating-a-cron-job","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/cron\/creating-a-cron-job","title":{"rendered":"Creating a cron job"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">The job file<\/h4>\n\n\n\n<p>A cron job is simply a file the OS will call periodically for you.  So just create a php file that will do what you want when you load it.  This means if you use it as a browser address it will also run and do the cron tasks &#8211; handy for testing.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Setting the cron job to run<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">Using wget<\/h5>\n\n\n\n<p>Use the hosting cron tasks feature to cause a wget command to be run at the interval you require.  An example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*\/15 * * * * wget -q -O - http:\/\/MYDOMAINNAME.com\/my_cronfile.php?doing_wp_cron<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Running the file without wget<\/h4>\n\n\n\n<p>Find the location of your file within the servers file system. You can likely just use your hosting file manager feature to locate the file and work out the full path to it.<\/p>\n\n\n\n<p>For the cron command you need to specify the php exe to use to run your php file &#8211; search up how to specify this<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The job file A cron job is simply a file the OS will call periodically for you. So just create a php file that will do what you want when you load it. This means if you use it as a browser address it will also run and do the cron tasks &#8211; handy for [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[239],"tags":[],"class_list":["post-2789","post","type-post","status-publish","format-standard","hentry","category-cron"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2789","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=2789"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2789\/revisions"}],"predecessor-version":[{"id":2791,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2789\/revisions\/2791"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=2789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=2789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=2789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}