Hello aapanel

Umbuto 20.04 Panel 7.0.7 Mysql 5.7.40
Sometimes Mysql crashes, I have to login and restart it. I need to set up a Cron that will
restart Mysql once a day. I found this start if stopped script on the forum.

pgrep -x mysqld &> /dev/null
if [ $? -ne 0 ]
then
echo "At time: date :MySQL is stop ."
/etc/init.d/mysqld start
fi

It will work if I manually stop Mysql from the panell, But not if it crashes.
A start command doesn't work.

I need a script that will --- restart--- Mysql like when the panel restart button is
pressed manually .

I appreciate your help
Thank You

3001panel