File: gridengine-client.wrapper

package info (click to toggle)
gridengine 6.2u5-7.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 57,216 kB
  • sloc: ansic: 438,030; java: 66,252; sh: 36,399; jsp: 7,757; xml: 5,850; makefile: 5,520; csh: 4,571; cpp: 2,848; perl: 2,401; tcl: 692; lisp: 669; yacc: 668; ruby: 642; lex: 344
file content (59 lines) | stat: -rw-r--r-- 1,401 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

# SGE Wrapper script to ensure correct environment variables are set

set -e

# For each of SGE_ROOT, SGE_CELL:
# 1) If the environment variable is set; use it
# 2) If not, look in /etc/default/gridengine
# 3) If still nothing, fall back to Debian defaults

DEFAULT_SGE_ROOT=/var/lib/gridengine
DEFAULT_SGE_CELL=default
CONFIG_PATH=/etc/default/gridengine
PROG=`basename $0`

# Save environment variables if we have been given them
# so we can restore them at the end
if [ ! -z "${SGE_ROOT}" ]; then
    _SAVED_SGE_ROOT="${SGE_ROOT}"
fi

if [ ! -z "${SGE_CELL}" ]; then
    _SAVED_SGE_CELL="${SGE_CELL}"
fi

# Read from our config file, this will set SGE_ROOT and/or SGE_CELL if
# appropriate

if [ -r "${CONFIG_PATH}" ]; then
    . "${CONFIG_PATH}"
fi

# If we still don't have anything set, fall back to the Debian defaults
if [ -z "${SGE_ROOT}" ]; then
    SGE_ROOT="${DEFAULT_SGE_ROOT}"
fi

if [ -z "${SGE_CELL}" ]; then
    SGE_CELL="${DEFAULT_SGE_CELL}"
fi

# If we had some environment variables, these should override
# anything else we were given so clobber it all again

if [ ! -z "${_SAVED_SGE_ROOT}" ]; then
    SGE_ROOT="${_SAVED_SGE_ROOT}"
fi

if [ ! -z "${_SAVED_SGE_CELL}" ]; then
    SGE_CELL="${_SAVED_SGE_CELL}"
fi

unset _SAVED_SGE_ROOT _SAVED_SGE_CELL

# Make sure we've exported the variables we need to
export SGE_ROOT SGE_CELL

exec /usr/lib/gridengine/${PROG} "$@"