Added a retry and error detection to wpe start
I got an error at the "start wpe" bit of the code, I think because the wpe started in between it checking if it was running and performing the command. I guess there could be a delay or issue with it detecting it running?
Either way, correctly responding to 16000 for this seems like a sensible outcome, so I've really only copy pasted the code from the above start fmserver section. I altered the timeout to 60 seconds as it shouldn't take as long as fmserver, and it possibly doesn't need the retries either.
A better result may be that capturing the 16000 error is done with the Invoke-FMSAdmin section itself, only on start commands, but my knowledge of PowerShell is too limited for that.
Log from the error :
Start FileMaker Server: _________________________________________________________
with timeout of 90 seconds, starting at 11:01:15 AM...
VERBOSE: C:\Program Files\FileMaker\FileMaker Server\Database Server\fmsadmin.exe start server
VERBOSE: Error: 10006 (Service already running)
PS>TerminatingError(): "fmsadmin exit code: 10006"
(If server is set to start automatically, error 10006 is expected)
start WPE because it was running before FMS was stopped, but isn't now:
VERBOSE: C:\Program Files\FileMaker\FileMaker Server\Database Server\fmsadmin.exe start wpe
VERBOSE: Error: 10006 (Service already running)
PS>TerminatingError(): "fmsadmin exit code: 10006"
>> TerminatingError(): "fmsadmin exit code: 10006"
fmsadmin exit code: 10006
At C:\Program Files\FileMaker\FileMaker Server\Data\Scripts\GetSSL.ps1:589 char:3
+ throw $e
+ ~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ApplicationException
+ FullyQualifiedErrorId : fmsadmin exit code: 10006
Stack Trace:
at Invoke-FMSAdmin, C:\Program Files\FileMaker\FileMaker Server\Data\Scripts\GetSSL.ps1: line 589
at Install-Cert, C:\Program Files\FileMaker\FileMaker Server\Data\Scripts\GetSSL.ps1: line 459
at <ScriptBlock>, C:\Program Files\FileMaker\FileMaker Server\Data\Scripts\GetSSL.ps1: line 935
at <ScriptBlock>, C:\Program Files\FileMaker\FileMaker Server\Data\Scripts\GetSSL.ps1: line 1072
at <ScriptBlock>, <No file>: line 2
I got an error at the "start wpe" bit of the code, I think because the wpe started in between it checking if it was running and performing the command. I guess there could be a delay or issue with it detecting it running?
That makes sense to me. I'm thinking a delay after starting FMS would be a good idea, to let it start sub-processes before trying to detect if they're running.
A better result may be that capturing the ~16000~ 10006 error is done with the Invoke-FMSAdmin section itself
I agree. I think this is the best solution overall. I'm going to test this, which will reduce some redundant code.
I tested on the same server I had issues with before, and this worked. Thanks.
Thanks for testing; I'm glad it worked.