check for dpkg lock, update mysql checks

This commit is contained in:
Matthew Saunders Brown 2024-03-14 15:23:30 -07:00
parent cdc8e7df85
commit aed7576594

View File

@ -30,6 +30,14 @@ if [ -d "/etc/apache2/" ] || [ -d "/etc/php/" ] || [ -d "/etc/varnish/" ]; then
sleep 5
fi
# check for dpkg lock
if lsof /var/lib/dpkg/lock-frontend ; then
echo "Could not get lock /var/lib/dpkg/lock-frontend"
echo "See output above for info on what is holding the lock."
echo "Wait for the command above to complete, then re-run this script."
exit 1
fi
apt-get update
# create local systemd dir
@ -56,6 +64,14 @@ if [ ! -d "/etc/mysql/" ]; then
mysql -e "CREATE USER 'nagios'@'localhost' IDENTIFIED WITH mysql_native_password AS '';"
mysqladmin flush-privileges
elif ! systemctl is-active --quiet mysql ; then
echo "MySQL config dir exists, but MySQL/MariaDB server is not running."
echo "Check your server config and either make sure MySQL is running"
echo "or purge MySQL/MariaDB and all related packages (e.g. mysql-common)"
echo "from the server and then re-run this installer."
exit 1
fi
# Apache w/ PHP