-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathglass_hyper
executable file
·106 lines (87 loc) · 2.72 KB
/
glass_hyper
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
#!/bin/bash
# This starts up a topaz session with a Swazoo server inside
# No gem-gem debugging
# bind explicitly to localhost because we always reverse proxy to localhost
if [ -s $GEMSTONE/seaside/etc/gemstone.secret ]; then
. $GEMSTONE/seaside/etc/gemstone.secret
else
echo 'Missing password file $GEMSTONE/seaside/etc/gemstone.secret'
exit 1
fi
# Requires a port number as a parameter
if [ "a$1" = "a" ]; then
echo 'Missing argument <server port number>'
exit 1
fi
# Requires a port number as a parameter
if [ "a$2" = "a" ]; then
echo 'Missing argument <gemstone name>'
exit 1
fi
GEMSTONE_NAME=$2
echo "GEMSTONE_NAME is $GEMSTONE_NAME"
# Make sure the environment is sane before we start up
if [ -z $LANG ]; then echo "LANG is not set, bailing out"; exit 3; fi
if [ -z $GEMSTONE_NAME ]; then echo "GEMSTONE_NAME is not set, bailing out"; exit 3; fi
# Kill anything on this port
fuser -kn tcp $1
sleep 1
fuser -n tcp $1
if [ $? == 0 ]; then
echo "Something is still holding on to port $1. Getting out"
exit 2
fi
exec $GEMSTONE/bin/topaz -l -T300000 -e /etc/gemstone/$GEMSTONE_NAME.conf << EOF
output push /tmp/Swazoo_server-${1}.log
set user DataCurator pass $GEMSTONE_CURATOR_PASS gems $2
display oops
iferror where
login
run
"record gems pid in the pid file"
| file |
(GsFile isServerDirectory: '$GEMSTONE_DATADIR') ifFalse: [ ^nil ].
file := GsFile openWriteOnServer: '$GEMSTONE_DATADIR/${1}_server-${2}.pid'.
file nextPutAll: (System gemVersionReport at: 'processId') printString.
file cr.
file close.
%
run
System transactionMode: #manualBegin.
Exception
installStaticException:
[:ex :cat :num :args |
"Run the abort in a lowPriority process, since we must acquire the
transactionMutex."
[
GRPlatform current transactionMutex
critical: [
GRPlatform current doAbortTransaction ].
System enableSignaledAbortError.
] forkAt: Processor lowestPriority.
]
category: GemStoneError
number: 6009
subtype: nil.
System enableSignaledAbortError.
"This thread is needed to handle the SigAbort exception, when the primary
thread is blocked on an accept. Assuming default 60 second
STN_GEM_ABORT_TIMEOUT, wake up at 30 second intervals."
[
[ true ] whileTrue: [ (Delay forSeconds: 30) wait ].
] forkAt: Processor lowestPriority.
GsFile gciLogServer: 'GS Web Server started on port ', $1 printString.
WAGemStoneRunSeasideGems startGemServerOn: $1.
"does not return"
%
run
GemToGemAnnouncement uninstallStaticHandler.
System beginTransaction.
(ObjectLogEntry
fatal: '$2: topaz exit'
object:
'port: ', $1 printString, ' ',
'pid: ', (System gemVersionReport at: 'processId') printString) addToLog.
System commitTransaction.
%
EOF