[Xastir] Snapshot question

Dan Brown brown at brauhaus.org
Sat Apr 2 16:45:54 EST 2005


On Sat, 2 Apr 2005, James Ewen wrote:
>
>  Bennett, Joe wrote:
> 
> > Is there any good documentation that someone could
> > point out that describes how to automate uploading the
> > snapshot? Am wanting to do as many have, add the
> > snapshot to a web page. Unfortunately, I'm not savvy
> > enough to know what is the best way, and/ or
> > understand some of the web pages I have seen that
> > explain ways to do this.
> 
> Again we see the usual response for Linux users... either way too simple or 
> far too complex. Isn't there a happy medium? 8)

I'm not sure if this falls in to the too simple or too complex category,
but here's my version.  I have a linux box, which is both where I run
xastir, as well as where I have an Apache based website.  After turning on
snapshots (File menu -> PNG Snapshots), Xastir saves snapshots as
~/.xastir/tmp/snapshot.png

My web pages end up as:

http://www.brauhaus.org/n8ysz/current.html
http://www.brauhaus.org/n8ysz/current/

On the web page, I used code in the header to "refresh" the image every 180
seconds.  To do this, I wrapped the image in some HTML, much of which was
simply gacked from looking at "view page source" of:
http://www.findu.com/cgi-bin/find.cgi?call=n8ysz

I copy the image using a shell script, called out of crontab.
This is the crontab entry I use: 

0-59/5 * * * * /home/brown/.xastir/scripts/snapshot.sh

Here's the shell script it calls: 

------------
#!/bin/sh

SNAPDIR=/home/brown/.xastir/tmp
SNAPFILE=$SNAPDIR/snapshot.png
DESTDIR=/var/www/html/n8ysz/current

# Probably only need one of these two lines: 
sudo /usr/local/bin/convert $SNAPFILE $DESTDIR/snapshot.jpeg
sudo /bin/cp $SNAPDIR/snap* $DESTDIR/

------------

Notes: 

- See section 5.3 in the FAQ. 

- convert is part of Imagemagic

- The crontab entry is for vixie cron.  If you don't have that, you could
use something like:

0,15,30,45 * * * * /somedir/snapshot.sh 

- Don't forget to chmod +x /somedir/snapshot.sh 

- PNG appears to be smaller than JPEG without any difference in quality
that I can see in a browser. 

- Xastir does snapshots every 300 seconds.  This is hard coded at compile
time, in maps.c. 

- Xastir can be told to turn snapshots on and off doing: 

   kill -SIGUSR1 `cat ~/.xastir/xastir.pid`


--
Dan Brown 
brown at brauhausdc.org




More information about the Xastir mailing list