I am very weak on unix shell scripting. Is there a way to create Unix shell script which will start on server boot time only, and will execute the following commands in order:
# cd /mysql
# ./bin/safe_mysqld --user=root &
# ./support-files/mysql.server start
The longer story... On a HP-UX server I've installed Mysql. However the client wanted the server to be installed in /mysql
instead in /usr/local/mysql/
which is the standard location. During the last week I've been struggling to set the mysql daemon to start automatically on server boot time.
I don't know what is the problem, but so far the only way to start the server is by using the above commands.
UPDATE: 07.02.12 15:23
This is a short output from the server boot when it starts the processes:
Start MySQL Server .................................................. OK
...
However after i enter ps -ef
I can easily tell that it is not started:
# ps -ef | grep -i mysql
root 3074 3056 0 15:26:53 pts/0 0:00 grep -i mysql
#
And this is how it should look like when i start the process:
# cd mysql
# ./bin/safe_mysqld --user=root &
[1] 3123
# Starting mysqld daemon with databases from /mysql/data
#
# ./support-files/mysql.server start
Starting MySQL
SUCCESS!
#
# ps -ef | grep -i mysql
root 3139 3123 0 15:27:19 pts/0 0:00 /mysql/bin/mysqld --basedir=/mysql --datadir=/mysql/data --u
root 3123 3056 0 15:27:19 pts/0 0:00 /bin/sh ./bin/safe_mysqld --user=root
root 3171 3056 0 15:27:59 pts/0 0:00 grep -i mysql
#
Now I think that it is more clear why I want to create a shell startup script and actually FORCE the starting of the process with those commands.