Subject: Should programs clean-up their /var/run/*.pid files?
To: current users <current-users@NetBSD.ORG>
From: Paul Goyette <>
List: current-users
Date: 06/06/1997 07:26:06
With my recent installation of (nearly) -current finally completed, I've
been using the new xntpd time-keeping stuff.  I've discovered that xntpd
fails to remove its /var/run/ file (specified with the -p
option) when it exits.

There's lots and lots (read: several dozens) of places where xntpd just
calls exit() without making any effort to remove the .pid file.

I've got a Mac IIci, and whenever I do my nightly backups to my tape drive
(SCSI drive, using polled transfers rather than DMA), my clock slows down
to about half of proper speed.  This ends up causing xntpd to exit every
night because the clock gets "too far" behind real time.  I'd like to be
able to run a cron job to detect and restart xntpd, but it seems I can't
rely on the presence or absence of the .pid file.

Right now, I'm using:

	if [ `ps -ax | grep -c " xntpd " -gt 1 ]; ...

to detect if xntpd is still running, but that isn't a very reliable way to
do it (ie, what if some user passed " xntpd " as an argument to their own
program?).  Anyone got any better ideas?  Or should xntpd be fixed to
remove its .pid file?

| Paul Goyette       | PGP Public Key fingerprint:  | E-mail addresses:     |
| Network Consultant |     0E 40 D2 FC 2A 13 74 A0  |    |
| and kernel hacker  |     E4 69 D5 BE 65 E4 56 C6  | |