Re: How to check if 'mysqld' is running?
Re: How to check if 'mysqld' is running?
- Subject: Re: How to check if 'mysqld' is running?
- From: email@hidden
- Date: Fri, 07 Dec 2001 15:26:51 -0500
On Friday, December 7, 2001, at 01:19 PM, Charles Bennett wrote:
[munched]
(e.g. httpd, sendmail, mysqld..)?
Related to this question . What is a sock file? What is a pid file?
Is there
a difference between pid and sock files?
A pid file is ususaly a plain old text file with the pid of the daemon
as the only text inside.
The very existance of the file (in /var/run/) should indicate that the
daemon is running,
because the daemon is supposed to delete that file on the way "down"
and create
it when the daemon starts.
Of course if the daemon dies the pid file might not be removed, so it's
wise
to check the contents of the file against something like getpriority()
to see if it's really running..
Don't know about mysql, but sometimes file locking is used on a pid
file.
That way, when the process unlocks the file _or_ dies then the lock
is freed. I think netscape's httpd does this. You have to check with some
flavor of Unix locking, but it might just be advisory locking. You can
still
read the file, and check if the process controls it by fcntl (?). You'd
have to check the daemon documentation, though.
ch