Found an example linux 'daemon' code for freepascal: http://paste.pocoo.org/show/13316/
That does a fpFork. I did a rewrite on it to store the pid in an file. So on the second call to the application it finds the pid and does an
Code:
fpKill(oldpid, SIGTERM);
to stop it again.

Now i am looking into FpSetuid to have it run under a specific user also.