Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Michael Van Canneyt
On Mon, 9 Nov 2009, Jonas Maebe wrote: On 09 Nov 2009, at 21:51, Michael Van Canneyt wrote: Hm. Quite complex code, and not processor independent. It never was processor-independent, because the siginfo codes already varied between architectures. I remember days when it was processor-i

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Jonas Maebe
On 09 Nov 2009, at 21:51, Michael Van Canneyt wrote: Hm. Quite complex code, and not processor independent. It never was processor-independent, because the siginfo codes already varied between architectures. Is there not a more generic way of handling this ? I doubt it. Jonas ___

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Michael Van Canneyt
On Mon, 9 Nov 2009, Jonas Maebe wrote: On 09 Nov 2009, at 21:03, Michael Van Canneyt wrote: On Mon, 9 Nov 2009, "Vinzent Höfler" wrote: As wrong as in "Don't call most system functions from within a signal handler.", maybe? Hmm... In that case, many exceptions would not work either ?

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Vinzent Höfler
Jonas Maebe : > On 09 Nov 2009, at 21:03, Michael Van Canneyt wrote: > > > On Mon, 9 Nov 2009, "Vinzent Höfler" wrote: > > > >> As wrong as in "Don't call most system functions from within a > >> signal handler.", maybe? > > > > Hmm... In that case, many exceptions would not work either ? > >

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Jonas Maebe
On 09 Nov 2009, at 21:03, Michael Van Canneyt wrote: On Mon, 9 Nov 2009, "Vinzent Höfler" wrote: As wrong as in "Don't call most system functions from within a signal handler.", maybe? Hmm... In that case, many exceptions would not work either ? The sigaction handlers for catching except

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Michael Van Canneyt
On Mon, 9 Nov 2009, "Vinzent Höfler" wrote: Michael Van Canneyt : On Mon, 9 Nov 2009, Wimpie Nortje wrote: It should stop the daemons properly. This is the code that gets executed: Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : PSigContext); cdecl; begin Application.Sto

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Vinzent Höfler
Michael Van Canneyt : > On Mon, 9 Nov 2009, Wimpie Nortje wrote: > > It should stop the daemons properly. This is the code that gets executed: > > Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : > PSigContext); > cdecl; > > begin >Application.StopDaemons(True); >Applicati

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Henry Vermaak
2009/11/9 Michael Van Canneyt : > > That's good news: I had it on my todo list to let the 'Install' mode > generate > this script in the appropriate directory. If I can use your script as a > start, then I can implement that. I've got /etc/init.d/skeleton (in debian), which looks like a very good

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Joost van der Sluis
On Mon, 2009-11-09 at 14:14 +0100, Michael Van Canneyt wrote: > > On Mon, 9 Nov 2009, Joost van der Sluis wrote: > > > > I don't know how I did it exactly, but I ahve this working properly in a > > production system. (Even created my own SysV init script for it. It > > should be generally usable f

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Wimpie Nortje
Joost van der Sluis wrote: On Mon, 2009-11-09 at 13:02 +0200, Wimpie Nortje wrote: Michael Van Canneyt wrote: It should stop the daemons properly. This is the code that gets executed: Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : PSigContext); cdecl; begin Appli

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Michael Van Canneyt
On Mon, 9 Nov 2009, Joost van der Sluis wrote: On Mon, 2009-11-09 at 13:02 +0200, Wimpie Nortje wrote: Michael Van Canneyt wrote: It should stop the daemons properly. This is the code that gets executed: Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : PSigContext); cdecl; b

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Joost van der Sluis
On Mon, 2009-11-09 at 13:02 +0200, Wimpie Nortje wrote: > > Michael Van Canneyt wrote: > > It should stop the daemons properly. This is the code that gets executed: > > > > Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : > > PSigContext); > > cdecl; > > > > begin > > Application.

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Jonas Maebe
On 09 Nov 2009, at 09:07, Michael Van Canneyt wrote: It should stop the daemons properly. This is the code that gets executed: Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : PSigContext); cdecl; begin Application.StopDaemons(True); Application.Terminate; end; If it doe

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Wimpie Nortje
Michael Van Canneyt wrote: It should stop the daemons properly. This is the code that gets executed: Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : PSigContext); cdecl; begin Application.StopDaemons(True); Application.Terminate; end; If it doesn't, something is wrong :(

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Marco van de Voort
In our previous episode, Wimpie Nortje said: > > No plans yet. The problem is also a bit that whatever you do is an island. I > > think this is more something for freedesktop to standarize first. > I know there is a standard/recomended way to write a daemon. If you use > KDevelop it will create s

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Michael Van Canneyt
On Mon, 9 Nov 2009, Wimpie Nortje wrote: Marc Santhoff wrote: You can send any defined signal using kill. Try: # kill -TERM for sending the TERM signal. At least FreeBSDs kill works that way. If yours doesn't try: That is what I did. This doesn't run my daemon's exit routines. I don't k

Re: [fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Wimpie Nortje
Marc Santhoff wrote: You can send any defined signal using kill. Try: # kill -TERM for sending the TERM signal. At least FreeBSDs kill works that way. If yours doesn't try: That is what I did. This doesn't run my daemon's exit routines. I don't know if Linux just kills the daemon or if t

Re: [fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Wimpie Nortje
Marco van de Voort wrote: No plans yet. The problem is also a bit that whatever you do is an island. I think this is more something for freedesktop to standarize first. I know there is a standard/recomended way to write a daemon. If you use KDevelop it will create such a template. I don'

Re: [fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Marc Santhoff
Am Sonntag, den 08.11.2009, 21:18 +0200 schrieb Wimpie Nortje: > Hi > > I am writing an application using lazdaemon. How does one stop the > daemon gracefully, ie not killing it. > > The wiki says the daemon runs until it receives the TERM signal. THe > only way I know to send the TERM signal i

Re: [fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Marco van de Voort
In our previous episode, Wimpie Nortje said: > Marco van de Voort wrote: > > In our previous episode, Wimpie Nortje said: > > > >> I am writing an application using lazdaemon. How does one stop the > >> daemon gracefully, ie not killing it. > >> > >> The wiki says the daemon runs until it recei

Re: [fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Wimpie Nortje
Marco van de Voort wrote: In our previous episode, Wimpie Nortje said: I am writing an application using lazdaemon. How does one stop the daemon gracefully, ie not killing it. The wiki says the daemon runs until it receives the TERM signal. THe only way I know to send the TERM signal is

Re: [fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Marco van de Voort
In our previous episode, Wimpie Nortje said: > > I am writing an application using lazdaemon. How does one stop the > daemon gracefully, ie not killing it. > > The wiki says the daemon runs until it receives the TERM signal. THe > only way I know to send the TERM signal is using 'kill'. This ki

[fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Wimpie Nortje
Hi I am writing an application using lazdaemon. How does one stop the daemon gracefully, ie not killing it. The wiki says the daemon runs until it receives the TERM signal. THe only way I know to send the TERM signal is using 'kill'. This kills the app rather letting it exit gracefully. Th