[Lazarus] How to update a running application

Marc Santhoff M.Santhoff at t-online.de
Sun Dec 7 13:48:39 CET 2008


Am Sonntag, den 07.12.2008, 12:24 +0100 schrieb Roland Turcan:
> Hello all,
> 
> I write a small systray application which I know, that time to time we
> will need to change/add/remove something, but this application is
> started from user's startup and runs until his log off.
> 
> When our update process gets newer version of it I need to close that
> application, exchange its components and start it again.
> 
> On windows I solve it using messaging, but on Linux I don't know what
> is the way to inform application about my wish to terminate it.
> 
> How can I solve this problem?
> 
> PS: I though about : 1) signal file as flag to close itself

This is the normal way on Unix-like system. Send your program a SIGTERM
or SIGUSR1 or so. I'm not really sure if programs compiled with fpc will
terminate automatically on SIGTERM but in all cases you can register a
signal handler for SIGUSR1 and do from the program whatever you like to
to (except setting the users cat on fire maybe ;).

Try:
$ man kill
$ man sigaction

(on FreeBSD, should be similar on Lunix)

HTH,
Marc





More information about the Lazarus mailing list