Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 2b6d57de11205d1e4ec8b18312057c35 > files > 97

initng-ifiles-0.1.5-4.fc12.i686.rpm

#!/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})
	}
}