Image feed scripting notes

Goals:
*One frame every five minutes from SMER
*One frame every 15 minutes from http://www.cru.uea.ac.uk/~timo/sunclock.htm

Method:
*Run RBNB on the mini, using parent-child routing to niagara-stage.sdsc.edu
*Run Tomcat on the mini for Webdav support
*Mount webdav locally so that we can use curl/wget to write images to DataTurbine

Problems, notes and caveats:
*I'd prefer to run Tomcat on niagara-stage, but I haven't solved the problem of binding Tomcat to specific IP yet.
*mount_webdav http://mini.phfactor.net:8080/RBNB/ /Volumes/RBNB/ should work but fails with an error in the console

system.log:Apr 11 11:38:33 dyn137-110-115-15 webdavfs_agent[49699]: (realpath(argv[optind + 1], mountPoint) != NULL) failed; going to error_exit; file: /SourceCache/webdavfs/webdavfs-252/mount.tproj/webdav_agent.c; line: 576

Workaround: Mount from the finder, so this can't be completely scripted yet.

Crontab looks like this:

# m h  dom mon dow   command
2,17,32,47 * * * * /Users/hubbard/bin/world-sun-clock.csh
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /Users/hubbard/bin/axis-smer.csh

world-sun-clock.csh:

#!/bin/bash
# Script to grab a single world clock image from the web and
# put it into Webdav as a video feed.
# pfh 4/10/08, based on SMER axis script
# No error checking, just stupid for first pass. Run from cron, is the plan.

cd /Volumes/RBNB
mkdir "World time"@"a=8064&c=48"
cd "World time"


# This one is free and easy to get, but we have to convert to JPG via imagemagick.
rm -f /tmp/image.png /tmp/image.jpg
curl -O f "http://www.cru.uea.ac.uk/~timo/sunclock.png" -o /tmp/image.png >& /dev/null
convert /tmp/image.png /Volumes/RBNB/"World time"/image.jpg

# Leave a zero-byte marker of when we last ran for cron debugging
touch /tmp/last-wc-fetch

axis-smer.csh:

#!/bin/bash
# Script to grab a single image from the Axis at SMER northern gorge.
# PFH 1/28/08, modified 4/11/08 for use at calit2
# No error checking, just stupid for first pass. Run from cron, is the plan.

cd /Volumes/RBNB
mkdir "SMER camera"@"a=8064&c=48"
cd "SMER camera"
curl -O -f http://172.23.37.63/jpg/image.jpg >& /dev/null

touch /tmp/last-smer-fetch

I also wrote a script to start everything up, note that the webdav mount just fails with RC 2 as noted above:

#!/bin/csh
# Script to start up an RBNB instance, 512MB of memory, using the 2TB chassis for 
# archive, parent-child routed to niagara-stage.sdsc.edu, with archives reloaded if possible.
# The Tomcat invocation is commented out but can be invoked as required.
# Dirty/quick hack code.
# NOTE: You still need to mount the DAV filesystem before the cron jobs will work!

cd /Volumes/Ocean/"DataTurbine runtime"

echo -n "Starting RBNB server...."
rm -f child-server-log.txt

nohup java -Xmx512M -jar $RBNB_HOME/bin/rbnb.jar -F -n "Aux video" -p niagara-stage.sdsc.edu >& child-server-log.txt &

echo " done."

echo -n "Starting Tomcat..."
cd $RBNB_HOME/bin
./Start_Webserver.sh
echo "done."

echo -n "Sleeping while Tomcat starts up...."
sleep 10

echo "OK."

echo -n "Mounting DAV filesystem..."
mount_webdav http://localhost:8080/RBNB/ /Volumes/RBNB/