| #!/bin/sh |
| |
| # Copyright 2002-2004 The Apache Software Foundation |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| ################################################### |
| # Script to process commands generated by the webapp |
| # It listens on stdin for single-line commands of the form: |
| # <action> <module> |
| # Eg 'refresh xml-site', 'publish xml-forrest' |
| ################################################### |
| |
| . `dirname $0`/local-vars |
| |
| function lookup_script() |
| { |
| echo $1-cvs.xml |
| } |
| |
| function refresh() |
| { |
| echo "Refreshing $module" |
| $BASE/refresh `lookup_script $module` >> $REFRESH_LOG 2>&1 |
| } |
| |
| function publish() |
| { |
| echo "Upload $module" |
| $BASE/publish_livesite $module >> $REFRESH_LOG 2>&1 |
| } |
| |
| while true; do |
| read action module |
| case $action in |
| refresh) |
| refresh $module |
| ;; |
| publish) |
| publish $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', 'publish'." |
| ;; |
| esac |
| done |
| |
| |