[Xastir] Saving serial snapshots

Carl Makin carl at stagecraft.cx
Wed Apr 15 21:43:17 EDT 2009


Hi Jim,

On Wed, 15 Apr 2009, Jim Tolbert wrote:

> I seem to have four "snapshot" files.... .png, xpm, kml, geo.  Do I want to 
> change the snapshot.jpg to snapshot.png in the code from Carl?

Yes.  the .png and .xpm files are straight images, the .kml is for loading 
it up into Google Earth and the .geo is for loading it back up into 
Xastir.

> An then ( just to show how ignorant I am....), what do I do with this code? 
> ... No, I am not kidding.  Do I type it in the terminal with the "sudo chmod 
> 666 /dev/ttyS0" before I start xastir?

You save it into a file, probably in /usr/local/bin.  Lets call it 
"mvsnapshot".  Then mark the file executable with;

chmod +x /usr/local/bin/mvsnapshot

Then you update your crontab "crontab -e" and insert the following;
*/4 * * * * cd /your/snapshot/dir ; /usr/local/bin/mvsnapshot > /dev/null 
2>&1

(all on one line...)

kick it off and see what happens.  Don't forget to create the "archive" 
directory in your snapshot directory.

Hmmm, thinking about this more, there might be a better way to do this. 
You could create a new script to start Xastir that kicks it regularly and 
does the move for you.  If you wanted snapshots then you just run this 
script to start Xastir.  It could look something like this;

------- Cut Here ---------------------------
#!/bin/sh

xastir &

sleep 300

while [ 1 ]; do
         kill -SIGUSR1 `cat ~/.xastir/xastir.pid`
 	sleep 10
         RIGHTNOW=`date +%Y%M%d%H%M`
         if [ -f ~/.xastir/tmp/snapshot.png ]; then
                 mv ~/.xastir/tmp/snapshot.png archive/snapshot-$RIGHTNOW.png
         fi
         sleep 290
done
------- Cut Here ---------------------------

Or you could remove the "xastir &" and "sleep 300" lines and launch it in 
a terminal window after you have started xastir.

There's actually a wiki page that covers this to some degree;

http://www.xastir.org/wiki/index.php/HowTo:Snapshots

Carl.
(vk1kcm)




More information about the Xastir mailing list