From 082eb1322546d39900950b943354d9dfe0f6636d Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 5 May 2000 14:29:48 +0000 Subject: [PATCH] Recovered these files from old source. --- src/BuildTiles/Parallel/Makefile.am | 2 + src/BuildTiles/Parallel/fgfs-launch-clients | 130 ++++++++++++++++++++ src/BuildTiles/Parallel/fgfs-launch-server | 106 ++++++++++++++++ src/BuildTiles/Parallel/genworklist.sh | 10 ++ 4 files changed, 248 insertions(+) create mode 100755 src/BuildTiles/Parallel/fgfs-launch-clients create mode 100755 src/BuildTiles/Parallel/fgfs-launch-server create mode 100755 src/BuildTiles/Parallel/genworklist.sh diff --git a/src/BuildTiles/Parallel/Makefile.am b/src/BuildTiles/Parallel/Makefile.am index 6cb74f18..00798be1 100644 --- a/src/BuildTiles/Parallel/Makefile.am +++ b/src/BuildTiles/Parallel/Makefile.am @@ -1,3 +1,5 @@ +EXTRA_DIST fgfs-launch-clients fgfs-launch-server genworklist.sh + bin_PROGRAMS = fgfs-tools-server fgfs-tools-client fgfs_tools_server_SOURCES = server.cxx diff --git a/src/BuildTiles/Parallel/fgfs-launch-clients b/src/BuildTiles/Parallel/fgfs-launch-clients new file mode 100755 index 00000000..b649bafe --- /dev/null +++ b/src/BuildTiles/Parallel/fgfs-launch-clients @@ -0,0 +1,130 @@ +#!/bin/sh + +# fgfs-launch-clinets -- script to launch fgfs scenery construction clients +# +# Written by Curtis Olson, started May 1999. +# +# Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id$ + +CLIENT=fgfs-tools-client +HOSTNAME=`uname -n` + +# check usage +if [ $# != 1 ]; then + echo "Usage: $0 base_dir" + exit +else + BASE_DIR=$1 + CLIENT_LIST_RUDE="${BASE_DIR}/clients.rude" + CLIENT_LIST_NICE="${BASE_DIR}/clients.nice" + WORK_BASE="${BASE_DIR}/Work" + OUTPUT_DIR="${BASE_DIR}/FlightGear" + LOG_DIR="${WORK_BASE}/Status" + SERVER_LOG_FILE=${LOG_DIR}/server.log + echo "Base directory is $BASE_DIR" + echo "Client list files are $CLIENT_LIST_RUDE $CLIENT_LIST_NICE" + echo "Work base is $WORK_BASE" + echo "Output base is $OUTPUT_DIR" + echo "Logging to $LOG_FILE" +fi + +SERVER_HOST=`grep "Server launched" $SERVER_LOG_FILE | awk '{ print $5 }'` +if [ "x$SERVER_HOST" = "x" ]; then + echo "Can't find server host name in $SERVER_LOG_FILE" + exit +else + echo "Server hostname is $SERVER_HOST" +fi + +SERVER_PORT=`grep port $SERVER_LOG_FILE | awk '{ print $7 }'` +if [ "x$SERVER_PORT" = "x" ]; then + echo "Can't find server port number in $SERVER_LOG_FILE" + exit +else + echo "Server port number is $SERVER_PORT" +fi + +# check if client binary exists +if type $CLIENT > /dev/null; then + echo "client: `type $CLIENT`" +else + echo "cannot locate $CLIENT" + exit +fi + +# read client lists +if [ -f $CLIENT_LIST_RUDE ]; then + TMP=`cat $CLIENT_LIST_RUDE` + CLIENTS_RUDE=`echo $TMP` +fi +if [ -f $CLIENT_LIST_NICE ]; then + TMP=`cat $CLIENT_LIST_NICE` + CLIENTS_NICE=`echo $TMP` +fi +echo "Rude clients = $CLIENTS_RUDE" +echo "Nice clients = $CLIENTS_NICE" + +# check if log directory exists, and if not, make it +if [ ! -d $LOG_DIR ]; then + mkdir -p $LOG_DIR +fi + +# launch a copy of the client process on each specified machine + +for i in $CLIENTS_RUDE; do + if ping -c 1 -i 5 $i > /dev/null; then + echo "Launching client process on $i" + else + echo "client $i is currently down, skipping" + continue + fi + + LOG_FILE="${LOG_DIR}/client-$i.log" + + # KILL_COMMAND="killall $CLIENT" + # ssh -n $i "$KILL_COMMAND" + + RMT_COMMAND="source ~/.profile; nice $CLIENT $SERVER_HOST $SERVER_PORT $WORK_BASE $OUTPUT_DIR -r" + echo "client command:" + echo "" + echo "$RMT_COMMAND" + echo "" + ssh -n $i "$RMT_COMMAND > $LOG_FILE 2>&1 &" +done + +for i in $CLIENTS_NICE; do + if ping -c 1 -i 5 $i > /dev/null; then + echo "Launching client process on $i" + else + echo "client $i is currently down, skipping" + continue + fi + + LOG_FILE="${LOG_DIR}/client-$i.log" + + # KILL_COMMAND="killall $CLIENT" + # ssh -n $i "$KILL_COMMAND" + + RMT_COMMAND="source ~/.profile; nice $CLIENT $SERVER_HOST $SERVER_PORT $WORK_BASE $OUTPUT_DIR" + echo "client command:" + echo "" + echo "$RMT_COMMAND" + echo "" + ssh -n $i "$RMT_COMMAND > $LOG_FILE 2>&1 &" +done \ No newline at end of file diff --git a/src/BuildTiles/Parallel/fgfs-launch-server b/src/BuildTiles/Parallel/fgfs-launch-server new file mode 100755 index 00000000..642237cc --- /dev/null +++ b/src/BuildTiles/Parallel/fgfs-launch-server @@ -0,0 +1,106 @@ +#!/bin/sh + +# fgfs-launch-server -- script to launch fgfs scenery construction server +# +# Written by Curtis Olson, started May 1999. +# +# Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id$ + + +SERVER=fgfs-tools-server + +# check usage +if [ $# -lt 2 ]; then + echo "Usage: $0 base_dir chunk1 chunk2 ..." + exit +else + BASE_DIR=$1 + shift + WORK_BASE="${BASE_DIR}/Work" + OUTPUT_DIR="${BASE_DIR}/FlightGear" + MASTER_ON="${WORK_BASE}/Status/MASTER_ON" + LOG_DIR="${WORK_BASE}/Status" + LOG_FILE="${LOG_DIR}/server.log" + echo "Base directory is $BASE_DIR" + echo "Work base is $WORK_BASE" + echo "Output base is $OUTPUT_DIR" + echo "Logging to $LOG_FILE" +fi + +# check if server binary exists +if type $SERVER > /dev/null; then + echo "server: `type $SERVER`" +else + echo "cannot locate $SERVER" + exit +fi + +# check if log directory exists, and if not, make it +if [ ! -d $LOG_DIR ]; then + mkdir -p $LOG_DIR +fi + +# kill any existing copies of the server +killall $SERVER + +# expand arguments as needed +TODO="" + +while [ $# -gt 0 ]; do + LEN=`echo $1 | wc -c` + if [ $LEN -eq 5 ]; then + echo "expanding $1" + for i in s80 s70 s60 s50 s40 s30 s20 s10 n00 n10 n20 n30 n40 n50 n60 \ + n70; do + TODO="$TODO ${1}${i}" + done + else + TODO="$TODO ${1}" + fi + shift +done +echo Work List = $TODO + +# launch the server in the background +SERVER_HOST=`hostname -f` +COMMAND="$SERVER $WORK_BASE $OUTPUT_DIR $TODO" +echo "Launching the server with the following options:" +echo "" +echo "$COMMAND" +echo "" +echo "Server launched on host: $SERVER_HOST" > $LOG_FILE +$COMMAND >> $LOG_FILE 2>&1 & + +# grab the PID +SERVER_PID=`echo $!` + +# wait for a moment +sleep 1 + +# grab the port number +SERVER_PORT=`grep port $LOG_FILE | awk '{ print $7 }'` + +# turn on the master switch +echo $SERVER_PORT > $MASTER_ON + +# finish +echo "server is now running in background:" +echo " host = $SERVER_HOST" +echo " pid = $SERVER_PID" +echo " port = $SERVER_PORT" diff --git a/src/BuildTiles/Parallel/genworklist.sh b/src/BuildTiles/Parallel/genworklist.sh new file mode 100755 index 00000000..bf7c1688 --- /dev/null +++ b/src/BuildTiles/Parallel/genworklist.sh @@ -0,0 +1,10 @@ +#! /bin/bash + +for lat in s90 s80 s70 s60 s50 s40 s30 s20 s10 n00 n10 n20 n30 n40 n50 n60 \ + n70 n80; do + for lon in w180 w170 w160 w150 w140 w130 w120 w110 w100 w090 w080 w070 \ + w060 w050 w040 w030 w020 w010 e000 e010 e020 e030 e040 e050 \ + e060 e070 e080 e090 e100 e110 e120 e130 e140 e150 e160 e170; do + echo "${lon}${lat}" + done +done