Re: Mac Developer Question

2004-05-22 Thread Hassan Schroeder
John Mistler wrote:
Aha, this revealed the .pid:
/usr/local/mysql-standard-4.0.18-apple-darwin6.8-powerpc/data/John-Mistlers-
Computer.local.pid
Now, this brings up a new question.  Is there a "sudo find" command I can
use to locate the proper .pid on any given computer?  I am hard coding this
into an application that will reset the root password to whatever the user
enters.  How can this be done if I don't know the location of the .pid file
ahead of time on their system?
Welcome to the Exciting World Of Installer Writing :-)
I'd recommend, in order, 1) take Greg Willits' suggestion to look
at embedded MySql rather than try to deal with the vagaries of a
possible existing installation, or 2) get a good shell (sh/bash)
scripting book. It's possible to do what you want fairly reliably
but it's a lot more than a one-liner! And OT for this list, too.
P.S. Is the host name in my example "local" or
"John-Mistlers-Computer.local"?
I believe this reflects some OS X wierdness, in that 'local' is a
dummy domain name, and the hostname is 'John-Mistlers-Computer'. I
am not a Mac person, this Powerbook's just a loaner for a project,
so you probably want to confirm that with some testing. Or ask on
a Mac-oriented dev list.
HTH,
--
Hassan Schroeder - [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
  dream.  code.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Mac Developer Question

2004-05-22 Thread John Mistler
Aha, this revealed the .pid:

/usr/local/mysql-standard-4.0.18-apple-darwin6.8-powerpc/data/John-Mistlers-
Computer.local.pid

Now, this brings up a new question.  Is there a "sudo find" command I can
use to locate the proper .pid on any given computer?  I am hard coding this
into an application that will reset the root password to whatever the user
enters.  How can this be done if I don't know the location of the .pid file
ahead of time on their system?

Thanks,

John

P.S. Is the host name in my example "local" or
"John-Mistlers-Computer.local"?

on 5/22/04 12:01 PM, Hassan Schroeder at [EMAIL PROTECTED] wrote:

> John Mistler wrote:
> 
>> I'm having trouble getting this line to work.  I have tried:
>> 
>> kill `cat /usr/local/mysql/bin/mysql/data/localhost.pid`
>> -> Not a directory
>> kill `cat /usr/local/mysql/data/localhost.pid`
>> -> Permission denied
>> 
>> I'm not sure if I have the wrong hostname, or if the command is more flawed
>> than that.  
> 
> Could be both; to start with, though, it should be pretty easy to
> confirm exactly where *.pid is, eh? If you're sure that the base
> directory is '/usr/local/', run
> 
> sudo find /usr/local -type f -name '*.pid' -print
> 
> and see what turns up.
> 
> Note: On my Powerbook, mysql data files (including .err, .pid) are
> located at /sw/var/mysql -- and I think they were installed there
> by default, because I'd never have chosen that :-)
> 
> And the file name on my system is the actual hostname'.pid', *not*
> just 'localhost.pid', in case that reference is literal...
> 
> HTH!


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Mac Developer Question

2004-05-22 Thread Hassan Schroeder
John Mistler wrote:
I'm having trouble getting this line to work.  I have tried:
kill `cat /usr/local/mysql/bin/mysql/data/localhost.pid`
-> Not a directory
kill `cat /usr/local/mysql/data/localhost.pid`
-> Permission denied
I'm not sure if I have the wrong hostname, or if the command is more flawed
than that.  
Could be both; to start with, though, it should be pretty easy to
confirm exactly where *.pid is, eh? If you're sure that the base
directory is '/usr/local/', run
  sudo find /usr/local -type f -name '*.pid' -print
and see what turns up.
Note: On my Powerbook, mysql data files (including .err, .pid) are
located at /sw/var/mysql -- and I think they were installed there
by default, because I'd never have chosen that :-)
And the file name on my system is the actual hostname'.pid', *not*
just 'localhost.pid', in case that reference is literal...
HTH!
--
Hassan Schroeder - [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
  dream.  code.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Mac Developer Question

2004-05-22 Thread John Mistler
I'm having trouble getting this line to work.  I have tried:

kill `cat /usr/local/mysql/bin/mysql/data/localhost.pid`
-> Not a directory
kill `cat /usr/local/mysql/data/localhost.pid`
-> Permission denied

I'm not sure if I have the wrong hostname, or if the command is more flawed
than that.  Furthermore, I need the command to work without requiring a
password or other response, because it is issued as a unix shell command to
initiate resetting the root password:

do shell script "kill `cat /usr/local/mysql/bin/mysql/data/localhost.pid`"
do shell script "/usr/local/mysql./bin/mysqld_safe --skip-grant-tables &"
do shell script "/usr/local/mysql/bin/mysqladmin -u root flush-priveleges
password '"&rootPassword&"'"
do shell script "/usr/local/mysql/bin/mysqladmin shutdown
do shell script "/usr/local/mysql./bin/mysqld_safe"


on 5/22/04 7:52 AM, Paul Bingman at [EMAIL PROTECTED] wrote:

> On Sat, 22 May 2004, John Mistler wrote:
> 
>> do shell script "kill cat /usr/local/mysql/bin/mysql/data/localhost.pid"
> 
> The kill command takes a numeric PID as its argument.  You need to get
> the pid out of the pidfile.  So to get the above to work you have to
> enclose cat and the filename in backticks:
> 
> kill `cat /usr/local/mysql/bin/mysql/data/localhost.pid`
> 
> This will run "cat /usr/local/mysql/bin/mysql/data/localhost.pid",
> getting the numeric pid from the file, then pass the pid to kill.
> 
> paul


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Mac Developer Question

2004-05-22 Thread Greg Willits
On May 22, 2004, at 2:12 AM, John Mistler wrote:
In the larger picture, I am wondering if there is a way to avoid all of
this.  Ideally, I would like for the application to come packaged with
MySQL, to install MySQL automatically (not sure what happens if MySQL
already exists on the system), and to never ask the user for a 
password.  In
fact, to just run MySQL in the background as if it were a part of my
application.  Any ideas on this?  However, in the short term, in order 
to
get it all working on my own computer I will need to get the above 
language
correct.
You should be looking into the embedded version of MySQL which is aimed 
exactly at these purposes.

-- greg willits
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Mac Developer Question

2004-05-22 Thread Paul Bingman
On Sat, 22 May 2004, John Mistler wrote:

> do shell script "kill cat /usr/local/mysql/bin/mysql/data/localhost.pid"

The kill command takes a numeric PID as its argument.  You need to get
the pid out of the pidfile.  So to get the above to work you have to
enclose cat and the filename in backticks:

  kill `cat /usr/local/mysql/bin/mysql/data/localhost.pid`

This will run "cat /usr/local/mysql/bin/mysql/data/localhost.pid",
getting the numeric pid from the file, then pass the pid to kill.

paul

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]