OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.14k stars 587 forks source link

Restart command addition to the server commands #28004

Open newmangreen opened 5 months ago

newmangreen commented 5 months ago

"restart" command is missing in server command list: https://openliberty.io/docs/latest/reference/command/server-commands.html

We have a version management web application and it needs to restart server since some shared lib changes occur. Since an application can't trigger "start" after "stop" command, we had to write a batch file(RestartServer.bat) to achieve this as below;

cd "C:\Program Files\IBM\WebSphere\Liberty\bin"
call server.bat stop %1
call server.bat start %1

It would be good to have "restart" command in server commands and anybody in such scenario would use it without an external batch.

jimblye commented 5 months ago

What do you suggest in the case where the stop command fails? There could be a communication error, in which we were not able to send the stop command to the server. We might also timeout waiting for the server to shutdown. In either case, the start command would immediately return with the message the server is already running.

You might want the restart command to just quit in the event that the server didn't stop. You might want an option to kill (kill -9) the server. (I expect this might be easier on Linux than Windows, since I believe we have the PID on Linux) I'm not sure about z/OS & IBMi. You might want to have a -timeout option on the restart command. The timeout would be for the stop.

Just pointing out some things to consider.