diff options
author | adam <adam@pkgsrc.org> | 2011-04-25 21:12:13 +0000 |
---|---|---|
committer | adam <adam@pkgsrc.org> | 2011-04-25 21:12:13 +0000 |
commit | 985ed0dd303debb9bc5bbeb0ea7d82fc3d6671e8 (patch) | |
tree | d3d2a98ac59fdc6d8ae3edf791fc5225c5ff9735 /databases/mysql55-server/files | |
parent | da4c2a8e7b3c83eecab9b7f01bfafc5a0e487e38 (diff) | |
download | pkgsrc-985ed0dd303debb9bc5bbeb0ea7d82fc3d6671e8.tar.gz |
MySQL is a SQL (Structured Query Language) database server. SQL is the most
popular database language in the world. MySQL is a client-server implementation
that consists of a server daemon `mysqld' and many different client
programs/libraries.
The main goals of MySQL are speed and robustness.
The base upon which MySQL is built is a set of routines that have been used in
a highly demanding production environment for many years. While MySQL is still
in development it already offers a rich and highly useful function set.
The official way to pronounce 'MySQL' is 'My Ess Que Ell' (Not MY-SEQUEL).
This package contains the MySQL server programs and libraries including
embedded server (by PKG_OPTION).
Diffstat (limited to 'databases/mysql55-server/files')
-rw-r--r-- | databases/mysql55-server/files/mysqld.sh | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/databases/mysql55-server/files/mysqld.sh b/databases/mysql55-server/files/mysqld.sh new file mode 100644 index 00000000000..58e29854b95 --- /dev/null +++ b/databases/mysql55-server/files/mysqld.sh @@ -0,0 +1,105 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: mysqld.sh,v 1.1.1.1 2011/04/25 21:12:15 adam Exp $ +# +# PROVIDE: mysqld +# REQUIRE: DAEMON LOGIN mountall +# KEYWORD: shutdown +# +# You will need to set some variables in /etc/rc.conf to start MySQL: +# +# mysqld=YES +# +# The following variables are optional: +# +# mysqld_user="mysql" # user to run mysqld as +# mysqld_datadir="/path/to/home" # path to MySQL database directory +# + +if [ -f /etc/rc.subr ]; then + . /etc/rc.subr +fi + +name="mysqld" +rcvar=${name} +command="@PREFIX@/bin/mysqld_safe" +procname="@PREFIX@/sbin/${name}" +: ${mysqld_user:=@MYSQL_USER@} +: ${mysqld_group:=@MYSQL_GROUP@} +: ${mysqld_datadir:=@MYSQL_DATADIR@} + +extra_commands="initdb" +initdb_cmd="mysqld_initdb" +start_precmd="mysqld_precmd" +start_cmd="mysqld_start" + +mysqld_precmd() +{ + if [ ! -d ${mysqld_datadir}/mysql ]; then + ${initdb_cmd} + fi +} + +mysqld_initdb() +{ + initdb="@PREFIX@/bin/mysql_install_db" + if [ ! -x ${initdb} ]; then + return 1 + fi + if [ -f ${mysqld_datadir}/mysql/host.frm ]; then + @ECHO@ "The MySQL database has already been initialized." + @ECHO@ "Skipping database initialization." + else + @ECHO@ "Initializing MySQL database system tables." + ${initdb} --force --user=${mysqld_user} \ + --datadir=${mysqld_datadir} || return 1 + if [ -d ${mysqld_datadir} ]; then + @CHOWN@ -R ${mysqld_user}:${mysqld_group} \ + ${mysqld_datadir} + fi + fi +} + +mysqld_start() +{ + for f in $required_files; do + if [ ! -r "$f" ]; then + @ECHO@ 1>&2 "$0: WARNING: $f is not readable" + if [ -z $rc_force ]; then + return 1 + fi + fi + done + @ECHO@ "Starting ${name}." + ulimit -n 4096 + cd @PREFIX@ + ${command} --user=${mysqld_user} --datadir=${mysqld_datadir} \ + --pid-file=${pidfile} ${mysqld_flags} \ + ${thread_flags} & +} + +if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then + load_rc_config $name + pidfile="${mysqld_datadir}/`@HOSTNAME_CMD@`.pid" + run_rc_command "$1" +else + if [ -f /etc/rc.conf ]; then + . /etc/rc.conf + fi + pidfile="${mysqld_datadir}/`@HOSTNAME_CMD@`.pid" + case "$1" in + initdb) + eval ${initdb_cmd} + ;; + stop) + if [ -r "${pidfile}" ]; then + @ECHO@ "Stopping ${name}." + kill `@CAT@ ${pidfile}` + fi + ;; + *) + eval ${start_precmd} + eval ${start_cmd} + ;; + esac +fi |