#!/sbin/itype # This is a i file, used by initng parsed by install_service # NAME: MySQL # DESCRIPTION: SQL database server # WWW: http://www.mysql.com/ service daemon/mysql/initdb { need = system/bootmisc; env DATA=/var/lib/mysql; script start = { if [ ! -d ${DATA}/db/mysql ] then if [ ! -d ${DATA} ] then /bin/mkdir -p ${DATA} chown mysql.mysql ${DATA} chmod go-rwx ${DATA} fi su mysql -c "/usr/bin/mysql_install_db" >/dev/null 2>&1 fi exec [ -f ${DATA}/db/mysql/db.frm ] }; } daemon daemon/mysql { need = system/bootmisc virtual/net/lo; use = daemon/mysql/initdb; env PIDFILE=/var/run/mysqld/mysqld.pid; exec daemon = /usr/bin/mysqld_safe --pid-file=${PIDFILE} --defaults-file=/etc/my.cnf; pid_file = ${PIDFILE}; script kill = { # Neccesary for mysqld to stop (we have to send the # SIGKILL to mysqld itself, but initng has the PID # of mysqld_safe - it has to for various reasons) kill $(cat ${PIDFILE}) } }