<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1027212" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1027212</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/cron-less-1-min#comment-1162109</link>
    <description> &lt;p&gt;In PHP, try:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;runProgram&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// THE MAIN CODE OF PROGRAM TO GO HERE&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;}&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// SET THE FOLLOWING TO HOW MANY TIMES TO RUN PER MINUTE&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$runPerMin &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$waitTime &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;floor&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;60&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$runPerMin&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt; &lt;br /&gt;for (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$t&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$t&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$runPerMin&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$t&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;++)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;runProgram&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;();&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;sleep&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$waitTime&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt; &lt;/p&gt;
&lt;p&gt;Keep in mind, this script will work based upon the assumption that your main programs execution takes a very minute time to execute. Now, if you are finding that the main part of the program takes 2 seconds to execute, change the one line to read &lt;strong&gt;$waitTime = floor(60/$runPerMin) &lt;em&gt;- 2&lt;/em&gt;;&lt;/strong&gt;. When you first try this, you may want to add code that checks the time it takes to execute. On my server, cron job results get e-mailed to me, so you could change the program to be:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// THIS FUNTION ONLY NEEDED FOR TIME TESTING&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;microtime_float&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;() { &lt;br /&gt;&amp;nbsp; list(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$usec&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$sec&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) = &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;explode&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot; \&quot;, microtime()); &lt;br /&gt;&amp;nbsp; return ((float)&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$usec&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; + (float)&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$sec&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;function runProgram()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; // THE MAIN CODE OF PROGRAM TO GO HERE&lt;br /&gt;}&lt;br /&gt;// SET THE FOLLOWING TO HOW MANY TIMES TO RUN PER MINUTE&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$runPerMin&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = 1;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$waitTime&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = floor(60/&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$runPerMin&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;for (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$t&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=0; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$t&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$runPerMin&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$t&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;++)&lt;br /&gt;{&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$startTime&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = microtime_float();&lt;br /&gt;&amp;nbsp; runProgram();&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$difTime&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = microtime_float() - &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$startTime&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;;&lt;br /&gt; echo \&quot;Funtion Executed in \&quot; . number_format(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$difTime&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;,4) . \&quot; seconds&amp;lt;br&amp;gt;\n\&quot;;&lt;br /&gt;&amp;nbsp; sleep(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$waitTime&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;This will give you the execution time each time the funtion is called. Then once you have an maximum (test it to do the max it could possibly do during a run), then take it out and adjust the subtraction.&lt;/p&gt;
&lt;p&gt;Also check with your hosting company to see if there are limits on how long a script can run, their server may somehow cut it off or not run it at all if they limit it less than 60 seconds.&lt;/p&gt;
&lt;p&gt; -Greg&lt;/p&gt;
 </description>
     <pubDate>Tue, 30 Nov 2004 04:11:02 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1162109 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
