Well, I still don't know why you are trying to do, but I guess you want to test the execution part of a service/daemon.
Just making a few tests for my own, I've got the same kind of problems with lazdaemon. I can eventually force by program the termination of the execute loop, but it's still not completely correct; the un-installation is not immediate, for instance.
I'm not sure if there is a problem within the population of the Terminate event inside Lazdaemon, or if I've wrongly interpreted how to use it.
Anyway, there is -at least- 2 other working possibilities:
1/ Try the daemon sample program coming with FPC (i.e. don't use any more the lazdaemon package). This one is working properly.
The sample code is located in (if you are using FPC 2.6.2):
$(LazarusDir)\fpc\2.6.2\source\packages\fcl-extra\examples.
Open the daemon.pp as a Program project (i.e. don't use a Lazarus application with forms, etc...) and compile it.
To install it, type (console mode) : daemon -i (assuming your .exe produced file is daemon.exe)
To uninstall it, type (console mode) : daemon -u
You can manually start and/or stop it using the windows service manager (if you're using windows).
A service called 'Test daemon' is created. You can see all its debug outputs into the windows event viewers (Applications part).
2/ Use a timer inside lazdeamon (windows solution only), to periodically call your own program part.
See this topic:
http://www.lazarus.freepascal.org/index.php/topic,20308.0.htmlThere are a few source code samples (attached files) using lazdaemon and a timer inside it.