- We need to install supervisor daemon
- Create /etc/supervisor/conf.d/mysql.conf config file
- Restart supervisor
apt-get install supervisor -y
echo "[program:mysqld]
command=/usr/bin/pidproxy /var/run/mysqld/mysqld.pid /usr/sbin/mysqld --pid-file=/var/run/mysqld/mysqld.pid
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=true
autostart=true
">/etc/supervisor/conf.d/mysql.conf
/etc/init.d/mysql stop
/etc/init.d/supervisor restart
NOTE - please make sure mysql is not being in the constant loop of restarting it might happend when we launch supervisor while mysqld is up and running