Note that there are some explanatory texts on larger screens.

plurals
  1. POShell Script Random Cron job
    text
    copied!<p>I setup a cronjob to call myscript.sh every 5 min which then calls a php file between 30 sec and 3 in time and I don't get it why the average Interval is 05:09. </p> <p>I want to call cron2_.php every 4-8 min but no chance to achieve that.</p> <p>Tank you.</p> <p>Cron Job: <code>*/5 * * * * myscript.sh</code></p> <p>Shell script: </p> <pre><code>#!/bin/sh # Grab a random value between 60-180 or ( between 30sec and 3 minutes ) value=$RANDOM while [ $value -gt 180 ] || [ $value -lt 30 ] ; do value=$RANDOM done # Sleep for that time. sleep $value # Exectue Cron. echo "Exectued on:$(date)" &gt;&gt; public_html/log_file.txt exec php -f public_html/cron2_.php </code></pre> <p>Here is the exectuion time for 2 hours: Average Interval -> 05:09</p> <pre><code> Execution Time Interval Min:Sec 13:02:52 00:00 13:07:06 04:14 13:11:35 04:29 13:17:34 05:59 13:21:55 04:21 13:26:54 04:59 13:32:00 05:06 13:35:50 03:50 13:42:44 06:54 13:47:03 04:19 13:51:26 04:23 13:56:48 05:22 14:01:53 05:05 14:07:42 05:49 14:12:15 04:33 14:16:22 04:07 14:23:01 06:39 14:27:17 04:16 14:32:21 05:04 14:35:57 03:36 14:42:14 06:17 14:45:44 03:30 14:52:52 07:08 14:56:50 03:58 15:02:57 06:07 15:06:43 03:46 15:12:26 05:43 15:16:29 04:03 15:22:00 05:31 15:25:35 03:35 15:31:51 06:16 15:37:51 06:00 15:42:56 05:05 15:47:32 04:36 15:50:36 03:04 15:55:45 05:09 16:02:15 06:30 16:06:10 03:55 16:11:11 05:01 16:15:56 04:45 16:21:58 06:02 16:25:56 03:58 16:31:09 05:13 16:37:06 05:57 16:42:30 05:24 16:45:36 03:06 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload