From: curt Date: Sat, 22 May 1999 01:16:15 +0000 (+0000) Subject: Initial revision. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d87e7ef7d73fde546577a05eeab7beca69f77015;p=flightgear.git Initial revision. --- diff --git a/Tools/Construct/Parallel/fgfs-launch-clients b/Tools/Construct/Parallel/fgfs-launch-clients new file mode 100755 index 000000000..4f3f587b1 --- /dev/null +++ b/Tools/Construct/Parallel/fgfs-launch-clients @@ -0,0 +1,120 @@ +#!/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="${BASE_DIR}/work.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 + echo "Launching client process on $i" + + 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 + echo "Launching client process on $i" + + 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/Tools/Construct/Parallel/fgfs-launch-server b/Tools/Construct/Parallel/fgfs-launch-server new file mode 100755 index 000000000..1601873e1 --- /dev/null +++ b/Tools/Construct/Parallel/fgfs-launch-server @@ -0,0 +1,86 @@ +#!/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 [ $# != 1 ]; then + echo "Usage: $0 base_dir" + exit +else + BASE_DIR=$1 + WORK_BASE="${BASE_DIR}/work" + OUTPUT_DIR="${BASE_DIR}/FlightGear" + MASTER_ON="${WORK_BASE}.status/MASTER_ON" + LOG_DIR="${BASE_DIR}/work.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 + +# launch the server in the background +SERVER_HOST=`hostname -f` +COMMAND="$SERVER $WORK_BASE $OUTPUT_DIR" +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" \ No newline at end of file diff --git a/Tools/Construct/Parallel/fgfs-shutdown b/Tools/Construct/Parallel/fgfs-shutdown new file mode 100755 index 000000000..d2791df2a --- /dev/null +++ b/Tools/Construct/Parallel/fgfs-shutdown @@ -0,0 +1,45 @@ +#!/bin/sh + +# fgfs-shutdwon -- script to shutdown all the tile building clients and 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 [ $# != 1 ]; then + echo "Usage: $0 base_dir" + exit +else + BASE_DIR=$1 + WORK_BASE="${BASE_DIR}/work" + MASTER_ON="${WORK_BASE}.status/MASTER_ON" + echo "Base directory is $BASE_DIR" + echo "Master ON file is $MASTER_ON" +fi + +# remove the MASTER_ON switch so all the clients exit +echo "Removing the master switch file so all the clients will stop" +/bin/rm $MASTER_ON + +# kill the server +echo "Killing the server" +killall $SERVER