#!/bin/sh ################################################### # Script to process commands generated by the webapp # It listens on stdin for single-line commands of the form: # # Eg 'refresh xml-site', 'upload xml-forrest' ################################################### . `dirname $0`/local-vars # If you change this, remember to change it in the JSP too REFRESH_LOG=$WEBAPP/WEB-INF/refresh_log.txt function lookup_script() { echo $1-cvs.xml } function refresh() { echo "Refreshing $module" $BASE/refresh `lookup_script $module` >> $REFRESH_LOG 2>&1 } function upload() { echo "Upload $module" $BASE/update_livesite $module >> $REFRESH_LOG 2>&1 } while true; do read action module case $action in refresh) refresh $module ;; upload) upload $module ;; quit) exit ;; '') # When stdin closes we get a continuous stream of EOFs. Sleep through these. sleep 2 ;; *) echo "Unknown command '$action'" echo "Available commands are 'refresh', 'upload'." ;; esac done