-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvoclientd
executable file
·117 lines (97 loc) · 2.97 KB
/
voclientd
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/sh
#+
# Name:
# voclientd
#
# Purpose:
#
# Description:
# This shell script invokes the VOClient daemon.
# It's not very complicated, but performs some argument manipulation
# prior to invoking java with the right classpath and classname.
#
# 1. If a class path is specified using either the CLASSPATH
# environment variable or the -classpath flag to this script,
# it will be added to the application classpath.
#
# 2. Any initial command-line arguments which look like they are destined
# for java itself (starting with -D or -X) will be sent to java,
# and the others will be sent to the application.
# Requisites:
# - java should be on the path.
#
# - the application jar file should exist in the same directory as this
# command.
#
# Credits:
# Based on the STILTS startup script by Mark Taylor (Starlink)
# Original version - Michael Fitzpatrick, NOAO, June 2006
# VOClient integration - DCT 2006-July-10
# Modified for NVOSS bin,java/lib install - DCT August 2006
# Modified for VO-CLI distro - Michael Fitzpatrick, NOAO, January 2008
# Generalized for VO-CLI distro - Michael Fitzpatrick, NOAO, January 2009
#-
# The following jar files come from the NVOSS Software distribution but are
# included with the VO-CLI distribution as well. They are needed to support
# the voclientd interface and are assumed to be in a directory called
# 'voclient.jars' in the same directory as the 'voclientd' command (this
# script).
# Determine the BIN and LIB directories.
if test -n "$VOCLI_HOME" -a -f "$VOCLI_HOME/voclientd"; then
appjar="$VOCLI_HOME/voclient.jar"
else
# Find where this script is located.
bindir="`dirname $0`"
appjar="$bindir/voclient.jar"
# Make sure it looks reasonable.
if test ! -f "${appjar}"
then
echo 1>&2 "Can't find VOClient daemon classes in ${jardir}"
exit 1
fi
# Locate the application jar file.
for j in $voc_jars; do
if test -z "$appjar" -a -f "$bindir/$j"; then
appjar="$bindir/$j"
jardir="$bindir/voclient.jars/"
fi
done
# Add the VOClient jar to the beginning of the CLASSPATH.
if test -f "${appjar}"; then
CLASSPATH="${appjar}:${CLASSPATH}"
fi
fi
# Pull out any arguments which look to be destined for the java binary.
javaArgs="-Xmx1024m"
while test "$1"
do
if echo $1 | grep -- '^-[XD]' >/dev/null; then
javaArgs="$javaArgs $1"
shift
elif [ "$1" = "-classpath" -a -n "$2" ]; then
shift
export CLASSPATH="$1"
shift
else
break
fi
done
# Check for Cygwin and transform paths.
case "`uname`" in
CYGWIN*)
if test -n "$CLASSPATH"; then
CLASSPATH=`cygpath --path --windows "${appjar}:$CLASSPATH"`
else
CLASSPATH=`cygpath --windows "${appjar}"`
fi
;;
*)
CLASSPATH="${appjar}:${CLASSPATH}"
;;
esac
# Execute the command.
java \
$javaArgs \
-classpath $CLASSPATH \
voclient.VOClientd \
"$@"