#!/bin/sh

predown() {
	echo -e "\nStoppo tutto..."
	echo "Stoppo apache..."
	httpd -k stop
	echo "Stoppo mysqld (pid: $mysqld_pid)..."
	kill $mysqld_pid
	exit 0
}

trap 'predown' HUP INT QUIT TERM

echo "Lancio mysqld..."
/usr/bin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mariadb/plugin --user=mysql --log-error=/var/lib/mysql/mysql.err --pid-file=mysql.pid &> /dev/null &
mysqld_pid=$!
echo "Lancio apache..."
httpd -k start

wait $!
