How to check if 'mysqld' is running?
How to check if 'mysqld' is running?
- Subject: How to check if 'mysqld' is running?
- From: Martin Kautz <email@hidden>
- Date: Fri, 07 Dec 2001 14:26:50 +0100
Hello,
I'm currently write a tiny app to check, if mysql is running on my machine.
Later it should be able to start and the mysql server from a pref pane.
(To whom it may concern: since version 3.23.45 it's possible to stop mysql,
prior versions did have a bug under Darwin preventing mysql from shutdown).
Well, what I did so far is changing the shell wrapper from
http://www.cocoadevcentral.com a little (Thx, Mr. Monitzer).
My app is starting a simple 'ps -ax | grep mysqld' and if it's find some
'mysql' stuff inside the output of 'ps' it's trying to determine, what
version of 'mysqld' is running. So far, so good. Showing information about
'mysqld' works as well as stopping the daemon by 'mysqld shutdown'.
Starting seems to be quiete tricky since I don't know that much about
authorization stuff...
What I wanted to know: Is there an easier way to check a running daemon
(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?
If 'mysqld' is up and running on my machine, there's always a
'/tmp/mysql.sock' file. However, if I try to check the file by
id mysqlflag=[NSFileHandle fileHandleForReadingAtPath:@"/tmp/mysql.sock"];
NSLog (@"DEBUGGER (xxx): --> %@", mysqlflag);
it sucks. /tmp/mysql.sock does not seems to be a regular file...
Can someone help me a little? Does someone know a similar project with
source code available?
TIA,
Martin
P.S. Sorry for my bad english. Sorry for being stupid in *NIX things.