Scripting is a try and error process.
Setup yourself a non production server, install mysql and try out this scripts. Modify them as you want until they work.
We can‘t tell you how the script must be build for your exact environment.
My suggestion:
Get familiar with this zabbix server. Get familiar what the script does. Find out where the mysql daemon binaries are stored. Adjust the script to use the new location.
Then run the script and analyze each error you get.
Also check out with your database admin or zabbix application owner if the script has worked.
Or get Zabbix support involved. They surely have a recommendation on how they want you to backup their application. Probably the already have working scripts you can use.
Thanks Your suggestion, its completely true that the pre/post script what include the VeeamHUB github site I have to modify to our environment. I thought these scripts are "universal" and its suitable to use all Linux server which contain mysql service. Now its clear, that it is not true. I tried out these pre/post scripts and modify some things, like mysql service location, now Veeam can run successfully the scripts:
#!/bin/bash
timeout=300
if [ -f /var/run/mysqld/mysqld.pid ]
then
mysql_pid=$(cat /var/run/mysqld/mysqld.pid) >/dev/null 2>&1
else
echo "$0 : Mysql not started or bad mysql pid file location" | logger
exit 1
fi
echo "$0 : Processing pre-freeze backup script" | logger
sudo service mysql stop & > /dev/null 2>&1
c=0
while [ true ]
do
if [ $c -gt $timeout ]
then
echo "$0 : timed out, mysql shutdown failed" | logger
exit 2
fi
# check if mysql is running
if [ -f /var/run/mysqld/mysqld.pid ]
then
echo "$0 : Waiting 5 more seconds for mysql shutdown" | logger
sleep 5
c=$((c+5))
else
echo "$0 : Mysql stopped" | logger
sync;sync
break
fi
done
#!/bin/bash
timeout=300
echo "$0 : processing post-thaw backup script" | logger
if [ -f /var/run/mysqld/mysqld.pid ]
then
mysql_pid=$(cat /var/run/mysqld/mysqld.pid) >/dev/null 2>&1
echo "$0 : Mysql already started with PID $mysql_pid" | logger
exit 1
fi
sudo service mysql start & > /dev/null 2>&1
c=0
while [ true ]
do
if [ $c -gt $timeout ]
then
echo "$0 : timed out, mysql startup failed" | logger
exit 2
fi
# check if mysql is running
if [ -f /var/run/mysqld/mysqld.pid ]
then
mysql_pid=$(cat /var/run/mysqld/mysqld.pid) >/dev/null 2>&1
echo "$0 : MySQL started with pid $mysql_pid" | logger
break
else
echo "$0 : Waiting 5 more seconds for mysql startup"
sleep 5
c=$((c+5))
fi
done