On Thu, Jul 16, 2009 at 06:39:11PM +0300, Matti Viljanen wrote:
> Hi
> 
> Long time, no mailing list!
> 
> First, these scripts are for Linux only. (I never even got the Windows client 
> working...)
> 
> I (finally!) got fed up with having to check my machine every now and then to 
> see if some inkscape process needed to be killed or some client started 
> because it had crashed and returned to command line.
> 
> I have written two bash scripts to workaround these problems - tilesLoop.sh 
> and inkscapeKiller.sh. I said workaround, because the real issue is IMHO 
> low-quality/errornous map data. They are CC-by-sa licensed, just to max out 
> OSM compatibility ;)
> 
> The scripts can be downloaded from 
> http://direc.wippies.net/tilesAtHomeTools.tar.gz (and the updated versions as 
> they come, too).
> -- 
> Matti Viljanen
> [email protected]
> 
> -- 
> Saunalahti DataPaketti - tilaa nyt, saat 2 kk veloituksetta ja Nettitikun 
> kaupan päälle!
> http://saunalahti.fi/gsm/gsmdatapaketti.php 
> 
> 
> _______________________________________________
> Tilesathome mailing list
> [email protected]
> http://lists.openstreetmap.org/listinfo/tilesathome

Brilliant. Some suggestions:



- remove stopfile.txt before the loop
- remove inkscapes preferences.xml in each loop, as a corrupted preferences.xml 
may stop tilesGen.pl 

jo...@perle:~/tiles/tilesAtHomeTools$ diff -u tilesLoop.sh.old tilesLoop.sh
--- tilesLoop.sh.old    2009-07-16 22:02:00.000000000 +0200
+++ tilesLoop.sh        2009-07-16 23:52:10.000000000 +0200
@@ -49,12 +49,15 @@
 fi
 
 COUNTER=0
+rm ./stopfile.txt
 while [ ! -e "./stopfile.txt" ]
 do
        # Increase 
        let COUNTER=COUNTER+1
        ./tilesGen.pl loop
 
+       rm ~/.inkscape/preferences.xml
+
        if [ ! -e "./stopfile.txt" ]
        then
                sleep 5
jo...@perle:~/tiles/tilesAtHomeTools$ 

In inkscapeKiller.sh:

- set delay to 300 s (5 mins) as you suggest in the comment - Since the
directory in my case does not appear in the inkscape command, use
"export-area" as a regexp to decide if it is a relevant process. Rename
TAHFOLDER to TAHREGEX to reflect this.




jo...@perle:~/tiles/tilesAtHomeTools$ diff -u inkscapeKiller.sh.old 
inkscapeKiller.sh
--- inkscapeKiller.sh.old       2009-07-16 22:04:43.000000000 +0200
+++ inkscapeKiller.sh   2009-07-17 00:04:09.000000000 +0200
@@ -49,16 +49,14 @@
 # Too long time makes no harm (except to your rendering stats!),
 # too short time kills still functioning processes.
 # My wild quess is that five minutes (300 seconds) is sure enough.
-DELAY=60
+DELAY=300
 
-# Set TAHFOLDER to the folder name your tilesGen.pl is in.
+# Set TAHREGEX to a string used in the inkscape command
 # This is used to make sure we only mind inkscape processes,
-# launched by tilesGen.pl. My full path is
-# /home/matti/tilesAtHome/tilesGen.pl
-# so I would set "tilesAtHome"
-TAHFOLDER=tilesAtHome
+# launched by tilesGen.pl.
+TAHREGEX=export-area
 
-if [ ${#TAHFOLDER} == 0 ]
+if [ ${#TAHREGEX} == 0 ]
 then
        echo "Please configure the script first with e.g. 'nano 
inkscapekiller.sh'"
        exit 1
@@ -75,7 +73,7 @@
        DATE=$(date +%H:%M:%S)
 
        COUNTER=0
-       for pid in `ps -o pid,cmd -C inkscape | grep $TAHFOLDER | awk '{ print 
$1 }'`
+       for pid in `ps -o pid,cmd -C inkscape | grep $TAHREGEX | awk '{ print 
$1 }'`
        do
                PIDS[COUNTER]=$pid
                let COUNTER++
@@ -85,7 +83,7 @@
        
        for pid in ${pi...@]}
        do
-               IMAGES[$pid]=`ps -p $pid -o cmd | grep $TAHFOLDER | awk '{ 
print $NF }'`
+               IMAGES[$pid]=`ps -p $pid -o cmd | grep $TAHREGEX | awk '{ print 
$NF }'`
        done
 
        sleep $DELAY
@@ -93,7 +91,7 @@
        DATE=$(date +%H:%M:%S)
        
        COUNTER=0
-       for pid in `ps -o pid,cmd -C inkscape | grep $TAHFOLDER | awk '{ print 
$1 }'`
+       for pid in `ps -o pid,cmd -C inkscape | grep $TAHREGEX | awk '{ print 
$1 }'`
        do
                NEW_PIDS[COUNTER]=$pid
                let COUNTER++
@@ -103,7 +101,7 @@
        
        for pid in ${pi...@]}
        do
-               NEW_IMAGES[$pid]=`ps -p $pid -o cmd | grep $TAHFOLDER | awk '{ 
print $NF }'`
+               NEW_IMAGES[$pid]=`ps -p $pid -o cmd | grep $TAHREGEX | awk '{ 
print $NF }'`
        done
 
        for oldpid in ${pi...@]}
@@ -115,7 +113,7 @@
                                if [ $IMAGES[$oldpid] == $IMAGES[$newpid] ]
                                then
                                        echo -n "$DATE " >> $LOGFILE
-                                       ps -C inkscape -o cmd | grep $TAHFOLDER 
>> $LOGFILE
+                                       ps -C inkscape -o cmd | grep $TAHREGEX 
>> $LOGFILE
                                        echo "Killing PID $oldpid"
                                        kill $oldpid
                                fi
jo...@perle:~/tiles/tilesAtHomeTools$ 



_______________________________________________
Tilesathome mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/tilesathome

Reply via email to