--- tilesGen.pl.old	2008-05-05 04:55:21.593750000 +0200
+++ tilesGen.pl	2008-05-08 00:44:51.000000000 +0200
@@ -306,6 +306,19 @@
 {
     exit(1);
 }
+elsif ($Mode eq "stop")
+{
+    if (open F, '>', "stopfile.txt") {
+      close F;
+      statusMessage("stop signal was sent to the currently running tilesGen.pl", $currentSubTask, $progressJobs, $progressPercent,1);
+      statusMessage("please note that it may take a while for it to exit", $currentSubTask, $progressJobs, $progressPercent,1);
+    } else {
+      statusMessage("stop signal was NOT sent to the currently running tilesGen.pl - stopfile.txt could NOT be created", $currentSubTask, $progressJobs, $progressPercent,1);
+    }
+    talkInSleep("you may safely press Ctrl-C now if you ran this as \"tilesGen.pl\" from the command line", 60);
+    exit(1);
+}
 elsif ($Mode eq "")
 {
     # ----------------------------------
@@ -334,6 +347,7 @@
     print "  $0 upload - uploads any tiles\n";
     print "  $0 upload_conditional - uploads tiles if there are many waiting\n";
     print "  $0 version - prints out version string and exits\n";
+    print "  $0 stop - signal to an already running instance to exit\n";
     print "\nGNU General Public license, version 2 or later\n$Bar\n";
 }

