Am Montag, den 02.10.2006, 17:51 +0200 schrieb Ales Katona:
> FreeBSD might or might not have /proc mounted. Default is no however, so
> you can't be sure.
> 
> However you can still save the pid # of the process in some file, then
> when starting a new one, read this number, check output of ps (or use
> syscalls if applicable) for given number and if "pos" finds the name of
> your app then it's running. Otherwise start and override the file.
> 
> This way even if you crash and then another process takes your old pid
> you still can see if it's your app or not.

At least FreeBSD 4 has a pid-file in /var/run:

$ ls /var/run/
cron.pid        emacs           ld.so.hints     ppp             sshd.pid
dev.db          inetd.pid       log             printer         syslog.pid
dhcpd           isdnd.pid       mountd.pid      run             utmp
dmesg.boot      ld-elf.so.hints moused.pid      sendmail.pid

$ cat /var/run/cron.pid
122

$ ps aux|grep cron
root     122  0,0  0,1  1056  768  ??  Ss   12:14am   0:00,00 /usr/sbin/cron

Don't know about os version 5 or 6 or 7 though ...

HTH,
Marc

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to