-
Notifications
You must be signed in to change notification settings - Fork 3
/
startSmalltalkServer
executable file
·116 lines (98 loc) · 3.46 KB
/
startSmalltalkServer
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
#!/bin/bash
#
# ./startSmalltalkServer runs a server Gem
# - first argument is the name of the server that will be looked up in
# Gemstone to startthe server
# - second argument is a port number
#
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 server name as a parameter
if [ "a$1" = "a" ]; then
echo 'Missing argument <server name>'
exit 1
fi
# Requires a port number as a parameter
if [ "a$2" = "a" ]; then
echo 'Missing argument <server port number>'
exit 1
fi
cat << EOF | nohup $GEMSTONE/bin/topaz -l -e $GEMSTONE/seaside/etc/seaside30.conf 2>&1 >> $GEMSTONE_LOGDIR/${1}_server-${2}.log &
set user DataCurator pass $GEMSTONE_CURATOR_PASS gems $GEMSTONE_NAME
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.
(ObjectLogEntry
info: '${1}_server-${2}: startup'
object: 'pid: ', (System gemVersionReport at: 'processId') printString) addToLog.
System commitTransaction
ifFalse: [
System abortTransaction.
nil error: 'Could not commit ObjectLog entry' ].
%
run
| x |
"set _cacheName: for Gem to get unique id in statmon output. see http://code.google.com/p/glassdb/issues/detail?id=132"
System _cacheName: ((x := '$1-' , (GsSession serialOfSession: System session) printString , '-' , System myUserProfile userId) copyFrom: 1 to: (x size min: 31)).
%
run
(GsProcess usingNativeCode not or: [(Smalltalk at: #TDDebugTool ifPresent: [:cls | cls enableRemoteBreakpoints])]) == true
ifTrue: [
"Enable remote Breakpoing handling, if not using Native code or TDDebugTool
is present and enableRemoteBreakpoints is true ... when a breakpoint is
set, vm disables native code, so there _is_ a performance penalty."
Breakpoint trappable: true.
GemToGemAnnouncement installStaticHandler.
System commitTransaction
ifFalse: [ nil error: 'Could not commit for GemToGemSignaling' ].
].
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 "#rtErrSignalAbort"
subtype: nil.
System enableSignaledAbortError.
"This thread is needed to handle the SigAbort exception, when the primary
thread is blocked. 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: '$1 Server started on port ', $2 printString.
WAGemStoneRunSmalltalkServer startGemServer: '$1' On: $2.
"does not return"
%
run
GemToGemAnnouncement uninstallStaticHandler.
System inTransaction
ifFalse: [ System beginTransaction ].
(ObjectLogEntry
fatal: '${1}_server_${2}: topaz exit'
object:
'pid: ', (System gemVersionReport at: 'processId') printString) addToLog.
System commitTransaction.
%
EOF