void-packages/srcpkgs/mysql/files/mysqld.rc
Juan RP 1534f5be21 Added mysql-5.1.14 build template.
--HG--
extra : convert_revision : 7414719ac4625fd2f8805d18fbd71096cba41eb6
2010-03-04 13:50:13 +01:00

47 lines
986 B
Text

#!/sbin/runscript
#
: ${MYSQLD_PIDFILE:=/var/run/mysqld/mysqld.pid}
: ${MYSQLD_DATADIR=/var/lib/mysql}
depend()
{
need net localmount
provide mysqld
}
start_pre()
{
if [ ! -d /var/run/mysqld ]; then
mkdir -p /var/run/mysqld
chown mysqld:mysqld /var/run/mysqld
fi
if [ ! -d ${MYSQLD_DATADIR} ]; then
ebegin "Initializing MySQL datadir: ${MYSQLD_DATADIR}"
mkdir -p ${MYSQLD_DATADIR}
/usr/bin/mysql_install_db --datadir=${MYSQLD_DATADIR} \
--user=mysqld 2>&1 >/dev/null && \
chown -R mysqld:mysqld ${MYSQLD_DATADIR}
eend $?
fi
}
start()
{
ebegin "Starting MySQL server"
start-stop-daemon --start --user mysqld:mysqld \
--pidfile ${MYSQLD_PIDFILE} --background \
--exec /usr/sbin/mysqld -- \
--basedir=/usr --datadir=${MYSQLD_DATADIR} \
--user=mysqld --pid-file=${MYSQLD_PIDFILE} \
--external-locking ${MYSQLD_ARGS} 2>&1 >/dev/null
eend $?
}
stop()
{
ebegin "Stopping MySQL server"
start-stop-daemon --stop --pidfile ${MYSQLD_PIDFILE}
eend $?
}