Externally signalling pharo VM for shutdown
Is there a way I can externally signal a running pharo-vm in order to request a shutdown equivalent to clicking on the close icon? I'd like to externally manage the start/stop of a Pharo image, but because the image can be used during development, I'd like to provide the user with a confirmation dialog instead of simply killing the process. Regards! Esteban A. Maringolo
Depends on how you want the user to access the image. Using Seaside you could do something like whats described here: http://book.seaside.st/book/advanced/deployment/maintaining/requesthandler Esteban A. Maringolo wrote
Is there a way I can externally signal a running pharo-vm in order to request a shutdown equivalent to clicking on the close icon?
I'd like to externally manage the start/stop of a Pharo image, but because the image can be used during development, I'd like to provide the user with a confirmation dialog instead of simply killing the process.
Regards!
Esteban A. Maringolo
-- View this message in context: http://forum.world.st/Externally-signalling-pharo-VM-for-shutdown-tp4804999p... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
You can do it with kill -15 PID And, this (requires OSProcess): makeStopHook "Answers the process that hooks to the OS signal that makes this worker to shutdown when the VM process receives a TERM signal from the OS." ^ [|semaphore| semaphore := OSProcess accessor forwardSigTerm. semaphore wait. self onTerminationSignal] forkAt: Processor systemBackgroundPriority named: 'Image TERMâ onTerminationSignal "The process for the VM of this image has received a TERM signal from the OS. React accordingly" self log: 'That''s all folks. This worker is shutting down. Bye bye...' level:#messages. OSProcess accessor restoreSigTerm. SmalltalkImage current snapshot: false andQuit: true.
On Feb 10, 2015, at 4:58 PM, Esteban A. Maringolo <emaringolo@gmail.com> wrote:
Is there a way I can externally signal a running pharo-vm in order to request a shutdown equivalent to clicking on the close icon?
I'd like to externally manage the start/stop of a Pharo image, but because the image can be used during development, I'd like to provide the user with a confirmation dialog instead of simply killing the process.
Regards!
Esteban A. Maringolo
Great. This is cool. Why this can't be part of the stock vm/image? Regards! Esteban A. Maringolo 2015-02-10 16:28 GMT-03:00 Sebastian Sastre <sebastian@flowingconcept.com>:
You can do it with
kill -15 PID
And, this (requires OSProcess):
makeStopHook "Answers the process that hooks to the OS signal that makes this worker to shutdown when the VM process receives a TERM signal from the OS."
^ [|semaphore| semaphore := OSProcess accessor forwardSigTerm. semaphore wait. self onTerminationSignal] forkAt: Processor systemBackgroundPriority named: 'Image TERMâ
onTerminationSignal "The process for the VM of this image has received a TERM signal from the OS. React accordingly"
self log: 'That''s all folks. This worker is shutting down. Bye bye...' level:#messages. OSProcess accessor restoreSigTerm. SmalltalkImage current snapshot: false andQuit: true.
On Feb 10, 2015, at 4:58 PM, Esteban A. Maringolo <emaringolo@gmail.com> wrote:
Is there a way I can externally signal a running pharo-vm in order to request a shutdown equivalent to clicking on the close icon?
I'd like to externally manage the start/stop of a Pharo image, but because the image can be used during development, I'd like to provide the user with a confirmation dialog instead of simply killing the process.
Regards!
Esteban A. Maringolo
Am 10.02.2015 um 21:25 schrieb Esteban A. Maringolo <emaringolo@gmail.com>:
Great. This is cool.
Why this can't be part of the stock vm/image?
Because it needs OSProcess ;) A zinc server is always present in the image. Sven made a ZnReadEvalPrintDelegate that you can easily hook in to execute a smalltalk snippet (if your host is secured). The good thing about Sebastians approach is that whenever the OS is shut down it is called with SIGTERM from the OS. So should fit nicely with orchestration of the machine. Norbert
Regards! Esteban A. Maringolo
2015-02-10 16:28 GMT-03:00 Sebastian Sastre <sebastian@flowingconcept.com>:
You can do it with
kill -15 PID
And, this (requires OSProcess):
makeStopHook "Answers the process that hooks to the OS signal that makes this worker to shutdown when the VM process receives a TERM signal from the OS."
^ [|semaphore| semaphore := OSProcess accessor forwardSigTerm. semaphore wait. self onTerminationSignal] forkAt: Processor systemBackgroundPriority named: 'Image TERMâ
onTerminationSignal "The process for the VM of this image has received a TERM signal from the OS. React accordingly"
self log: 'That''s all folks. This worker is shutting down. Bye bye...' level:#messages. OSProcess accessor restoreSigTerm. SmalltalkImage current snapshot: false andQuit: true.
On Feb 10, 2015, at 4:58 PM, Esteban A. Maringolo <emaringolo@gmail.com> wrote:
Is there a way I can externally signal a running pharo-vm in order to request a shutdown equivalent to clicking on the close icon?
I'd like to externally manage the start/stop of a Pharo image, but because the image can be used during development, I'd like to provide the user with a confirmation dialog instead of simply killing the process.
Regards!
Esteban A. Maringolo
participants (4)
-
Esteban A. Maringolo -
Norbert Hartl -
Paul DeBruicker -
Sebastian Sastre