BUG: Preserve face zone orientation (fvMeshSubset, removeCels, addPatchCellLayer)
[OpenFOAM-1.6.x.git] / bin / foamDistccd
blob2a450a2b1714aee1b30ec28b49bc1450b9c55634
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #-------------------------------------------------------------------------------
9 # License
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 # for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM; if not, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 # Script
27 # foamDistccd
29 # Description
30 # Script to control distccd daemons. (distcc/distccd is a distributed
31 # C/C++ compilation frontend). Distccd daemons need to be running
32 # on all platforms one wants to build on. The platforms are specified
33 # in the DISTCC_HOSTS environment variable.
35 #------------------------------------------------------------------------------
37 printUsage()
39 echo "Usage : `basename $0` start|stop|list"
40 echo ""
43 RSH='ssh'
45 if [ ! "$DISTCC_HOSTS" ]; then
46 echo "`basename $0`: variable DISTCC_HOSTS not set."
47 echo "`basename $0`: please set DISTCC_HOSTS to the list of hosts to use."
48 echo "`basename $0`: the format is host1:port host2:port host3:port etc."
49 echo ""
51 exit 1
54 if [ $# -ne 1 ]; then
55 printUsage
56 exit 1
60 if [ "$1" = 'start' ]; then
62 grep -v '^#' /etc/hosts | awk '{print $1, $2 " "}' > ~/filteredHosts.txt
64 allowIPS=''
65 for host in $DISTCC_HOSTS
67 machine=`echo "$host" | awk -F: '{print $1}'`
68 iptest=`echo "$machine" | sed -e 's/[0-9.]//g'`
69 if [ ! "$iptest" ]; then
70 # address only contained 0-9 and '.'. Probably ip address.
71 ip=$machine
72 else
73 # address probably not ip address. Try searching /etc/hosts
74 ip=`egrep " $machine " ~/filteredHosts.txt | awk '{print $1}'`
77 if [ ! "$ip" ]; then
78 echo "$0 : host specifier $host either is not an ip address or cannot be found in /etc/hosts."
79 echo "$0 : Exiting."
80 exit 1
83 allowIPS="$allowIPS --allow $ip"
84 done
85 echo "allowIPS=$allowIPS"
87 for host in $DISTCC_HOSTS
89 echo ""
90 echo "Trying to start distccd on host $host ..."
92 machine=`echo "$host" | awk -F: '{print $1}'`
93 port=`echo "$host" | awk -F: '{print $2}'`
95 if [ "$machine" -a "$port" ]; then
96 #echo "Machine:$machine port:$port"
97 echo "distccd --daemon $allowIPS --port $port"' --jobs `egrep "^processor" /proc/cpuinfo | wc -l`'
98 $RSH $machine "distccd --verbose --daemon $allowIPS --port $port"' --jobs `egrep "^processor" /proc/cpuinfo | wc -l`'
99 else
100 echo "$0 : host specifier $host not in correct form machine:port."
101 echo "$0 : Exiting."
102 exit 1
104 done
106 elif [ "$1" = 'stop' ]; then
108 for host in $DISTCC_HOSTS
110 echo ""
111 echo "Trying to stop all distccd on host $host ..."
113 machine=`echo "$host" | awk -F: '{print $1}'`
115 $RSH $machine killall distccd
116 done
119 elif [ "$1" = 'list' ]; then
121 for host in $DISTCC_HOSTS
123 echo ""
124 echo "Trying to find process distccd on host $host ..."
126 machine=`echo "$host" | awk -F: '{print $1}'`
128 $RSH $machine "ps -ef | grep distccd | grep -v grep"
129 done
131 else
133 printUsage
134 exit 1
138 #------------------------------------------------------------------------------