File: init_cluster

package info (click to toggle)
gridengine 8.1.9%2Bdfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 56,880 kB
  • sloc: ansic: 432,689; java: 87,068; cpp: 31,958; sh: 29,429; jsp: 7,757; perl: 6,336; xml: 5,828; makefile: 4,701; csh: 3,928; ruby: 2,221; tcl: 1,676; lisp: 669; yacc: 519; python: 503; lex: 361; javascript: 200
file content (92 lines) | stat: -rwxr-xr-x 2,561 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
#
# Simple SGE cluster creation script.
# Mainly used from gridengine-master postinst
#
# Copyright (C) 2008 Mark Hymers <mhy@debian.org>
# Licensed under the BSD license as found in /usr/share/common-licenses/BSD
#

set -e

if [ $# -ne 4 ]; then
    echo "Usage: init_cluster <SGE_ROOT> <SGE_CELL> <spooldir> <manageruser>"
    exit 1
fi

export SGE_ROOT=$1
export SGE_CELL=$2
spooldir=$3
manager=$4

baseconf=/usr/share/gridengine/default-configuration
basecomplex=/usr/share/gridengine/util/resources/centry
baseuserset=/usr/share/gridengine/util/resources/usersets

if [ -e ${spooldir}/sge ]; then
    echo "${spooldir}/sge already exists: skipping cluster initialization"
    exit 0
fi

echo "Initializing cluster with the following parameters:"
echo " => SGE_ROOT: $SGE_ROOT"
echo " => SGE_CELL: $SGE_CELL"
echo " => Spool directory: $spooldir"
echo " => Initial manager user: $manager"

# Initialise the spool
echo "Initializing spool ($spooldir)"
/usr/lib/gridengine/spoolinit berkeleydb libspoolb ${spooldir} init

# Initialize global configuration
echo "Initializing global configuration based on ${baseconf}"
/usr/lib/gridengine/spooldefaults configuration ${baseconf}

# Initialize complexes:
echo "Initializing complexes based on ${basecomplex}"
/usr/lib/gridengine/spooldefaults complexes ${basecomplex}

# Initialize default usersets:
echo "Initializing usersets based on ${baseuserset}"
/usr/lib/gridengine/spooldefaults usersets ${baseuserset}

# Add $manageruser as a manager
echo "Adding user ${manager} as a manager"
/usr/lib/gridengine/spooldefaults managers ${manager}

cat >$SGE_ROOT/$SGE_CELL/common/settings.sh <<EOF
SGE_ROOT=$SGE_ROOT; export SGE_ROOT
SGE_CELL=$SGE_CELL; export SGE_CELL
SGE_ARCH=`$SGE_ROOT/util/arch`; export SGE_ARCH
EOF

cat >$SGE_ROOT/$SGE_CELL/common/settings.csh <<EOF
setenv SGE_ROOT $SGE_ROOT
setenv SGE_CELL $SGE_CELL
setenv SGE_ARCH `$SGE_ROOT/util/arch`
EOF

cat > $SGE_ROOT/$SGE_CELL/common/sge.module <<EOF
#%Module1.0                         -*-tcl-*-

proc ModulesHelp { } {
    puts stderr "\tSets up the Grid Engine batch system"
}

module-whatis "Grid Engine batch system"

set sge_root "$SGE_ROOT"
set sge_cell "$SGE_CELL"
set sge_arch "`$SGE_ROOT/util/arch`"

setenv SGE_ROOT "\$sge_root"
setenv SGE_CELL "\$sge_cell"
setenv SGE_CLUSTER_NAME "`cat $SGE_ROOT/$SGE_CELL/common/cluster_name 2>/dev/null`"
prepend-path PATH "$sge_root/bin/$sge_arch"
prepend-path PATH "$sge_root/bin"
prepend-path MANPATH "$sge_root/man:`$SGE_ROOT/util/arch -m`"
EOF

echo "Cluster creation complete"

exit 0