[Tilesathome] small server config

Arvid Andersson subreg at rvd.se
Sat Nov 10 14:48:21 GMT 2007


acracia wrote:
> I would like to configure my tilesathome to do the following:
>
> * Maintain a local map, rendering when needed or by a command
> * Upload to tah whenever it creates a full tileset with fresh information
> * Start to render information from the server after N minutes idle
>
> In this way, I can contribute to tilesathome an at the same time I
> become a new node that will render what it needs...
>
> Until now I just can see two options: Local or upload. am I missing
> something?
>   
I was thinking of something like that myself. How about this. It will 
render all tiles between the values you enter, then start rendering from 
the server queue. Create the file ".render_local" to start over (in a 
daily cron job for instance).

I haven't run the script with the actual tilesGen.pl commands, but the 
looping should work. :)

/Arvid Andersson

-- script below --

#!/bin/bash

x_min="2182"
x_max="2185"
y_min="1237"
y_max="1242"

stopfile="stopfile.txt"
local_file=".render_local"
render="local"
x=$x_min
y=$y_min

function inc_xy {
   if (( $x <= $x_max )); then
       x=$[x+1]
   fi
   if (( $x > $x_max && $y < $y_max )); then
       x=$x_min
       y=$[y+1]
   fi
}

function render_local {
   perl tilesGen.pl xy $x $y
   inc_xy
}

function render_queue {
   perl tilesGen.pl
}

function upload {
   perl upload.pl
}

function what_to_render {
   if (( $x > $x_max && $y == $y_max )); then
       render="queue"
   fi
   if [[ -e "$local_file" ]]; then
       render="local"
       x=$x_min
       y=$y_min
       rm "$local_file"
   fi
}

while [[ ! -e "$stopfile" ]]; do
   what_to_render
   if [[ "$render" == "local" ]]; then
       render_local
   else
       render_queue
   fi
   upload
done

echo "stopfile found, exiting"
exit 0





More information about the Tilesathome mailing list