--- /dev/null
+<?php
+
+$url = "";
+$file = "";
+if(isset($argv[1])) {
+ $url = $argv[1];
+}
+
+if(isset($argv[2])) {
+ $file = $argv[2];
+}
+
+if($url == "" || $file == "") {
+ echo "need a url and file\n";
+ exit(0);
+}
+
+if(file_exists("$file/update.lock")) {
+ // try get a lock
+ $lf = fopen("$file/update.lock", "r");
+ if($lf) {
+ $lockres = flock($lf, LOCK_EX|LOCK_NB);
+ if(!$lockres) {
+ error_log("flock did fail, all is right with the world a download is in progress");
+ exit(0);
+ }
+ } else {
+ error_log("weird problem");
+ }
+}
+fclose($lf);
+$lf = fopen("$file/update.lock", "w");
+flock($lf, LOCK_EX|LOCK_NB);
+
+
+?>
\ No newline at end of file