Hi All,
-- I have a headless Seaside program under Linux that I would like to execute some clean up code when the Linux system is being shutdown or the program is being killed. With Windows NT service you register the service and define a method to be called when Windows wants the service to stop. Is there something similar with Linux? Lou You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hmm. Actuallly, I don't know exactly how to catch them, but in Linux a process gets a signal like SIGTERM or SIGKILL before / when it is killed. I am pretty sure I once read you can react to them, but I am not so sure. I haven't looked into this because there is nothing to clean up in our case. We haven't seen any problems at restart yet. Linux doesn't have such a complicated beast as Windows services, Just running programs and daemons live systemd to start them at certain events, depending on prerequisites and such. Joachim Am Mittwoch, 5. September 2018 15:45:48 UTC+2 schrieb Louis LaBrunda:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Louis, From another thread I think you were using a /etc/init.d/ file right? If that's the case, can't you simple hook in the shutdown of that .sh ? Cheers, On Thu, Sep 6, 2018 at 3:45 AM Joachim Tuchel <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by jtuchel
Hi Joachim,
-- Thanks for the reply. I thought Linux would do something like what you describe. I expect the Linux VM could catch one or more of these signals. The question then becomes, does the VM catch any of these and what does the VM do about it. Hopefully it could do something like what Windows does, call a previously specified (by the image) method. This is easy for me to say but I think it wouldn't be that hard for the Linux VM to do since the Windows VM does it. The Linux VM may have this feature and i just don't know about it. I think this feature is broader than my particular case but examining this case may be enlightening. As Mariano asks in his post, I do start the application at boot time with a script in /etc/init.d/. That script calls another script that starts the Smalltalk VM. Both scripts log some information in a log file and the application logs things in another log file. I ran a test where I killed the program from htop. The application log didn't show any knowledge of being told to or about the exit. However the script log showed that the application exited with a zero (0) return code. From that I would conclude that the VM did catch something about being killed and did enough to exit with a zero return code. It is possible that some termination code was run before the exit but I don't know if it did. In any case that is probably not enough to every use case and it would be nicer to be able to specify a method and have it do everything that needs to be done. So, if this feature exists in the Linux VM, I would like to know how to use it and if not, maybe it can be added to a to do list. Lou On Thursday, September 6, 2018 at 2:45:35 AM UTC-4, Joachim Tuchel wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Mariano Martinez Peck-2
Hi Mariano,
-- On Thursday, September 6, 2018 at 7:31:28 AM UTC-4, marianopeck wrote:
You are correct. A script in /etc/init.d/ runns at boot and it runs another script that starts the Smalltalk VM.
I'm not sure what you mean here? In and case I don't think the script could do the same things the Smalltalk image could do, like cleaning up connections to the outside world (interfaces) and closing files (not that any should be open but you get what I mean). Lou
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Louis LaBrunda
Louis, I am trying to get a bunch of things done before ESUG, so I am a bit in a hurry. But maybe this will help in finding what you are looking for: http://www.instantiations.com/docs/91/wwhelp/wwhimpl/js/html/wwhelp.htm#href=sv/server34.html Please post what you find here. We don't have a need for cleaning anything up at the moment, but this may change. Joachim Am Donnerstag, 6. September 2018 16:01:24 UTC+2 schrieb Louis LaBrunda:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Joachim, Thanks for the lead, it is exactly what I was looking for. I guess I need to do a better job searching the documentation. This:
will tell the system where to go when it gets a SIGTERM signal. The #stop method can then do whatever you want. Also, if you want to know the PID of the VM you can use this:
note that THREAD_LIB must be set in the .ini file. It already was set in the .ini file supplied for the Raspberry VM and i expect it is set for the other UNIX VM but I didn't check. Lou On Friday, September 7, 2018 at 4:58:58 AM UTC-4, Joachim Tuchel wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Lou, thanks a lot for this info. Saves me time to research myself. So we did a good job together, didn't we ;-) ? Now, not that I am an expert or expect you to have an immediate answer: are you sure this only catches the SIGTERM signal or does it also catch the others (not that I really understand all the differences between, say SIGTERM and SIGKILL etc.). Die you also look at testing for which one the VM caught? Joachim Am Freitag, 7. September 2018 17:59:03 UTC+2 schrieb Louis LaBrunda:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Joachim,
-- On Saturday, September 8, 2018 at 9:18:40 AM UTC-4, Joachim Tuchel wrote:
We did do a good job together:)
The documentation only talks about SIGTERM and not SIGKILL but it does say it catches the result of doing a "kill pid", which I did test and it worked as expected. So, I would guess it catches them all. Maybe if Seth reads this he can tell us for sure. When I get a chance I will try shutting down and then check my log where I can tell if the stop code was called. Lou
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Louis LaBrunda
Hi All,
-- In case anyone missed this in the other thread, the preferred way of getting the PID of the VM this it is: System osProcessId Lou On Friday, September 7, 2018 at 11:59:03 AM UTC-4, Louis LaBrunda wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |