<input type="hidden" id="_wpnonce" name="_wpnonce" value="db42c9eb15" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/2633" /><input type="hidden" id="_wpnonce" name="_wpnonce" value="db42c9eb15" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/2633" />{"id":2633,"date":"2014-08-23T21:08:15","date_gmt":"2014-08-23T11:08:15","guid":{"rendered":"https:\/\/www.businesslegions.com\/blog\/?p=2633"},"modified":"2014-08-30T22:11:26","modified_gmt":"2014-08-30T12:11:26","slug":"creating-cron-job-zpanel","status":"publish","type":"post","link":"https:\/\/www.businesslegions.com\/blog\/2014\/08\/23\/creating-cron-job-zpanel\/","title":{"rendered":"How to create Cron Jobs in Zpanel"},"content":{"rendered":"<!--CusAds0--><p>I&#8217;ve been using Zpanel for the past year and\u00a0it&#8217;s a free Open Source Tool similar to Cpanel. Instead of paying $10 a month for using Cpanel, Zpanel is the free alternative. There are limited features with using Zpanel, for example it doesn&#8217;t have\u00a0the option (One Click Install) to install WordPress, Joomla or the other open source packages. You need to do this manually. I found creaing Cron Jobs in Zpanel a little bit more difficult compared to Cpanel. But here&#8217;s what I had to do.<\/p>\n<h1>STEPS: CRON JOB IN ZPANEL<\/h1>\n<p>1. Create the php script.\u00a0Here&#8217;s an example to trigger a php file hosted on your website: <div id=\"wpshdo_1\" class=\"wp-synhighlighter-outer\"><div id=\"wpshdt_1\" class=\"wp-synhighlighter-expanded\"><table border=\"0\" width=\"100%\"><tr><td align=\"left\" width=\"80%\"><a name=\"#codesyntax_1\"><\/a><a id=\"wpshat_1\" class=\"wp-synhighlighter-title\" href=\"#codesyntax_1\"  onClick=\"javascript:wpsh_toggleBlock(1)\" title=\"Click to show\/hide code block\">Source code<\/a><\/td><td align=\"right\"><a href=\"#codesyntax_1\" onClick=\"javascript:wpsh_code(1)\" title=\"Show code only\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/code.png?strip=all&w=960\" \/><\/a>&nbsp;<a href=\"#codesyntax_1\" onClick=\"javascript:wpsh_print(1)\" title=\"Print code\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/printer.png?strip=all&w=960\" \/><\/a>&nbsp;<a href=\"https:\/\/www.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/About.html\" target=\"_blank\" title=\"Show plugin information\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/info.gif?strip=all&w=960\" \/><\/a>&nbsp;<\/td><\/tr><\/table><\/div><div id=\"wpshdi_1\" class=\"wp-synhighlighter-inner\" style=\"display: block;\"><pre class=\"php\" style=\"font-family:monospace;\"><span class=\"kw2\">&lt;?php<\/span> \n<span class=\"re0\">$sUrl<\/span> <span class=\"sy0\">=<\/span> <span class=\"st0\">&quot;http:\/\/www.businesslegions.com\/script.php&quot;<\/span><span class=\"sy0\">;<\/span>\n&nbsp;\n<span class=\"re0\">$rCh<\/span> <span class=\"sy0\">=<\/span> <a href=\"http:\/\/www.php.net\/curl_init\"><span class=\"kw3\">curl_init<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$sUrl<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span>\n<a href=\"http:\/\/www.php.net\/curl_setopt\"><span class=\"kw3\">curl_setopt<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$rCh<\/span><span class=\"sy0\">,<\/span> CURLOPT_USERAGENT<span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko Firefox\/11.0&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span>\n<a href=\"http:\/\/www.php.net\/curl_setopt\"><span class=\"kw3\">curl_setopt<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$rCh<\/span><span class=\"sy0\">,<\/span> CURLOPT_RETURNTRANSFER<span class=\"sy0\">,<\/span> 1<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span>\n<a href=\"http:\/\/www.php.net\/curl_setopt\"><span class=\"kw3\">curl_setopt<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$rCh<\/span><span class=\"sy0\">,<\/span> CURLOPT_NOBODY<span class=\"sy0\">,<\/span> 1<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span>\n<a href=\"http:\/\/www.php.net\/curl_setopt\"><span class=\"kw3\">curl_setopt<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$rCh<\/span><span class=\"sy0\">,<\/span> CURLOPT_CONNECTTIMEOUT<span class=\"sy0\">,<\/span> 0<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span>\n<a href=\"http:\/\/www.php.net\/curl_setopt\"><span class=\"kw3\">curl_setopt<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$rCh<\/span><span class=\"sy0\">,<\/span> CURLOPT_SSL_VERIFYPEER<span class=\"sy0\">,<\/span> <span class=\"kw4\">false<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span>\n<a href=\"http:\/\/www.php.net\/curl_setopt\"><span class=\"kw3\">curl_setopt<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$rCh<\/span><span class=\"sy0\">,<\/span> CURLOPT_SSL_VERIFYHOST<span class=\"sy0\">,<\/span> <span class=\"kw4\">false<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span>\n<a href=\"http:\/\/www.php.net\/curl_exec\"><span class=\"kw3\">curl_exec<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$rCh<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span>\n<a href=\"http:\/\/www.php.net\/curl_close\"><span class=\"kw3\">curl_close<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"re0\">$rCh<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span>\n<span class=\"sy1\">?&gt;<\/span><\/pre><\/div><\/div> 2. SSH to your server and create a folder under public_html called cron (this is just an example folder name) 3. Upload or save this file the file to \/public_html\/cron 4. Login to your Zpanel and click on Cron Manager <a href=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2014\/08\/Zpanel-Cron-Manager.png?strip=all&w=2560\"><img decoding=\"async\" class=\"alignnone wp-image-2639 size-medium\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2014\/08\/Zpanel-Cron-Manager-300x233.png?strip=all\" alt=\"Zpanel Cron Manager\" width=\"300\" height=\"233\" srcset=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2014\/08\/Zpanel-Cron-Manager-300x233.png?strip=all 300w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2014\/08\/Zpanel-Cron-Manager.png?strip=all 723w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2014\/08\/Zpanel-Cron-Manager.png?strip=all&amp;w=144 144w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2014\/08\/Zpanel-Cron-Manager.png?strip=all&amp;w=433 433w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2014\/08\/Zpanel-Cron-Manager.png?strip=all&amp;w=578 578w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a> 5. Enter the location and name of the script, for example \/public_html\/cron\/script.php Enter a comment or a description of the script 6. Select when the script will be executed. The options are: Every 1 minute Every 5 minutes Every 10 minutes Every 30 minutes Every 1 hour Every 2 hours Every 8 hours Every 12 hours Every 1 day Every week Every month <a href=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2014\/08\/Zpanel-Cron-Manager-Script.png?strip=all&w=2560\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-2640\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2014\/08\/Zpanel-Cron-Manager-Script-300x191.png?strip=all\" alt=\"Zpanel Cron Manager Script\" width=\"300\" height=\"191\" \/><\/a> 7. Click create NOTE: If you run into a problem saying that the System Cron file could not be created then login to your server and issue this command: <div id=\"wpshdo_2\" class=\"wp-synhighlighter-outer\"><div id=\"wpshdt_2\" class=\"wp-synhighlighter-expanded\"><table border=\"0\" width=\"100%\"><tr><td align=\"left\" width=\"80%\"><a name=\"#codesyntax_2\"><\/a><a id=\"wpshat_2\" class=\"wp-synhighlighter-title\" href=\"#codesyntax_2\"  onClick=\"javascript:wpsh_toggleBlock(2)\" title=\"Click to show\/hide code block\">Source code<\/a><\/td><td align=\"right\"><a href=\"#codesyntax_2\" onClick=\"javascript:wpsh_code(2)\" title=\"Show code only\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/code.png?strip=all&w=960\" \/><\/a>&nbsp;<a href=\"#codesyntax_2\" onClick=\"javascript:wpsh_print(2)\" title=\"Print code\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/printer.png?strip=all&w=960\" \/><\/a>&nbsp;<a href=\"https:\/\/www.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/About.html\" target=\"_blank\" title=\"Show plugin information\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/info.gif?strip=all&w=960\" \/><\/a>&nbsp;<\/td><\/tr><\/table><\/div><div id=\"wpshdi_2\" class=\"wp-synhighlighter-inner\" style=\"display: block;\"><pre class=\"php\" style=\"font-family:monospace;\"><a href=\"http:\/\/www.php.net\/chmod\"><span class=\"kw3\">chmod<\/span><\/a> <span class=\"sy0\">-<\/span>R 777 <span class=\"sy0\">\/<\/span><span class=\"kw2\">var<\/span><span class=\"sy0\">\/<\/span>spool<span class=\"sy0\">\/<\/span>cron<\/pre><\/div><\/div> To check the cron jobs use the following command: <div id=\"wpshdo_3\" class=\"wp-synhighlighter-outer\"><div id=\"wpshdt_3\" class=\"wp-synhighlighter-expanded\"><table border=\"0\" width=\"100%\"><tr><td align=\"left\" width=\"80%\"><a name=\"#codesyntax_3\"><\/a><a id=\"wpshat_3\" class=\"wp-synhighlighter-title\" href=\"#codesyntax_3\"  onClick=\"javascript:wpsh_toggleBlock(3)\" title=\"Click to show\/hide code block\">Source code<\/a><\/td><td align=\"right\"><a href=\"#codesyntax_3\" onClick=\"javascript:wpsh_code(3)\" title=\"Show code only\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/code.png?strip=all&w=960\" \/><\/a>&nbsp;<a href=\"#codesyntax_3\" onClick=\"javascript:wpsh_print(3)\" title=\"Print code\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/printer.png?strip=all&w=960\" \/><\/a>&nbsp;<a href=\"https:\/\/www.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/About.html\" target=\"_blank\" title=\"Show plugin information\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/info.gif?strip=all&w=960\" \/><\/a>&nbsp;<\/td><\/tr><\/table><\/div><div id=\"wpshdi_3\" class=\"wp-synhighlighter-inner\" style=\"display: block;\"><pre class=\"php\" style=\"font-family:monospace;\">crontab <span class=\"sy0\">-<\/span>u apache <span class=\"sy0\">-<\/span>l<\/pre><\/div><\/div>\n<h2>\u00a0ANOTHER ALTERNATIVE<\/h2>\n<p>I found that the php script that I use to trigger a website doesn&#8217;t really work when you execute a zpanel script. What I ended up doing is modifying the crontab script by using: crontab -u apache -e I deleted the commands that was generated by Zpanel and replaced it with my own<\/p>\n<p>0,30 * * * * wget -q -O \/dev\/null &#8220;http:\/\/www.businesslegions.com\/trigger&#8221;<\/p>\n<p>If you are not sure about the timer settings\u00a0then have a look at this reference guide:\u00a0<a title=\"Cron Job\" href=\"http:\/\/en.wikipedia.org\/wiki\/Cron\" target=\"_blank\">http:\/\/en.wikipedia.org\/wiki\/Cron<\/a><\/p>\n<p>That&#8217;s it. If there&#8217;s anything that I missed please let me know.<\/p>\n<div class=\"lt-box\" style=\"border:1px solid #1d6a9e\"><div class=\"lt-box-title\" style=\"background-color:#2485C6;border-top:1px solid #a7cee8;text-shadow:1px 1px 0 #0b283b\">DO YOU LIKE WHAT YOU'VE READ?<\/div><div class=\"lt-box-content\">Join our subscription list and receive our content right in your mailbox. If you like to receive some Great deals our Freebies then subscribe now!\r\n\r\n<p><div class=\"tnp tnp-subscription \">\n<form method=\"post\" action=\"https:\/\/www.businesslegions.com\/blog\/wp-admin\/admin-ajax.php?action=tnp&amp;na=s\">\n<input type=\"hidden\" name=\"nlang\" value=\"\">\n<div class=\"tnp-field tnp-field-firstname\"><label for=\"tnp-1\">Name<\/label>\n<input class=\"tnp-name\" type=\"text\" name=\"nn\" id=\"tnp-1\" value=\"\" placeholder=\"\"><\/div>\n<div class=\"tnp-field tnp-field-email\"><label for=\"tnp-2\">Email<\/label>\n<input class=\"tnp-email\" type=\"email\" name=\"ne\" id=\"tnp-2\" value=\"\" placeholder=\"\" required><\/div>\n<div class=\"tnp-field tnp-field-button\" style=\"text-align: left\"><input class=\"tnp-submit\" type=\"submit\" value=\"Subscribe\" style=\"\">\n<\/div>\n<\/form>\n<\/div>\n<\/p>\r\n\r\n<\/div><\/div><!--CusAds0-->\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been using Zpanel for the past year and\u00a0it&#8217;s a free Open Source Tool similar to Cpanel. Instead of paying $10 a month for using Cpanel, Zpanel is the free alternative. There are limited features with using Zpanel, for example it doesn&#8217;t have\u00a0the option (One Click Install) to install WordPress, Joomla or the other open [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2639,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,382],"tags":[1652,1666,819,131,1665],"class_list":["post-2633","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","category-wordpress","tag-cron","tag-cron-manager","tag-example","tag-job","tag-zpanel"],"_links":{"self":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/2633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/comments?post=2633"}],"version-history":[{"count":11,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/2633\/revisions"}],"predecessor-version":[{"id":2690,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/2633\/revisions\/2690"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media\/2639"}],"wp:attachment":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media?parent=2633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/categories?post=2633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/tags?post=2633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}