{"id":485,"date":"2014-10-17T17:34:34","date_gmt":"2014-10-17T15:34:34","guid":{"rendered":"http:\/\/192.168.0.118\/wp\/?p=485"},"modified":"2014-10-17T17:34:34","modified_gmt":"2014-10-17T15:34:34","slug":"run-scripts-on-linuxubuntu-every-few-seconds-faster-than-cron-can-do-it","status":"publish","type":"post","link":"https:\/\/doc.zumbrunnen.ch\/index.php\/2014\/10\/17\/run-scripts-on-linuxubuntu-every-few-seconds-faster-than-cron-can-do-it\/","title":{"rendered":"Run scripts on Linux every few seconds, faster than Cron can do it."},"content":{"rendered":"<p>With Cron you can run php scripts every minute but not in shorter period of time. So what can you do when you need to run your script every 15 seconds or even 1 second ?<\/p>\n<p>Create shell sctipt like this one fasterthancron.sh<\/p>\n<pre class=\"lang:default decode:true \" >#!\/bin\/bash\n#This script run every seconds\nwhile (sleep 1 &amp;&amp; php \/path_to_script\/faster_than_cron.php) &amp;\ndo\n  wait $!\ndone<\/pre>\n<p><strong>Reference : <\/strong><br \/>\n<a href='https:\/\/coderwall.com\/p\/x0fqmw'>Ivan \u0110ur\u0111evac : Run scripts on Linux\/Ubuntu every few seconds, faster than Cron can do it.<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With Cron you can run php scripts every minute but not in shorter period of time. So what can you do when you need to run your script every 15 seconds or even 1 second ? Create shell sctipt like this one fasterthancron.sh #!\/bin\/bash #This script run every seconds while (sleep 1 &amp;&amp; php \/path_to_script\/faster_than_cron.php) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,15],"tags":[39],"class_list":["post-485","post","type-post","status-publish","format-standard","hentry","category-linux","category-scripts","tag-fast-cron"],"_links":{"self":[{"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/posts\/485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/comments?post=485"}],"version-history":[{"count":0,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/posts\/485\/revisions"}],"wp:attachment":[{"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/media?parent=485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/categories?post=485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/tags?post=485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}