@@ -106,13 +106,12 @@ sub start {
106
106
my $count = 0;
107
107
my $success = 0;
108
108
my $config = $self -> wreConfig;
109
- $config -> set(" wreMonitor/starmanAdministrativelyDown" , 0);
110
109
my $host = WRE::Host-> new(wreConfig => $config );
111
110
unless ($config -> get(" starman/port" ) > 1024 || $host -> isPrivilegedUser) {
112
111
croak " You are not an administrator on this machine so you cannot start services with ports 1-1024." ;
113
112
}
114
113
my $cmd = " " ;
115
- # start_server --pid-file=/data/wre/var/run/starman.pid --port=8081 --status=/data/wre/var/run/starman.status starman --preload-app= /data/WebGUI/app.psgi
114
+ # start_server --pid-file=/data/wre/var/run/starman.pid --port=8081 --status=/data/wre/var/run/starman.status -- starman --preload-app /data/WebGUI/app.psgi
116
115
$cmd = $config -> getRoot(" /prereqs/bin/start_server" )
117
116
. " --pid=" . $config -> getRoot(" var/run/starman.pid" )
118
117
. " --status=" . $config -> getRoot(" var/run/starman.status" )
@@ -130,6 +129,9 @@ sub start {
130
129
sleep (1);
131
130
eval {$success = $self -> ping };
132
131
}
132
+ if ($success ) {
133
+ $config -> set(" wreMonitor/starmanAdministrativelyDown" , 0);
134
+ }
133
135
return $success ;
134
136
}
135
137
@@ -153,11 +155,18 @@ sub stop {
153
155
unless ($config -> get(" starman/port" ) > 1024 || $host -> isPrivilegedUser) {
154
156
croak " You are not an administrator on this machine so you cannot stop services with ports 1-1024." ;
155
157
}
156
- # kill "TERM", 0;
158
+ open my $pid_file , $config -> getRoot(' var/run/starman.pid' ) or
159
+ croak " Unable open PID file " .$config -> getRoot(' var/run/starman.pid' )." for reading $! \n " ;
160
+ my $pid = do { local $/ ; <$pid_file > };
161
+ close $pid_file ;
162
+ kill " TERM" , $pid ;
157
163
while ($count ++ < 10 && $success ) {
158
164
sleep (1);
159
165
eval { $success = $self -> ping };
160
166
}
167
+ if ($success ) {
168
+ $config -> set(" wreMonitor/starmanAdministrativelyDown" , 1);
169
+ }
161
170
return $success ;
162
171
}
163
172
0 commit comments