Check that file exists

This commit is contained in:
Bob Mottram 2016-12-04 12:10:17 +00:00
parent 9176ac12d7
commit 0825cdd1ed
1 changed files with 6 additions and 2 deletions

View File

@ -137,7 +137,9 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
if [ ! -d /var/log/mysql ]; then
mkdir /var/log/mysql
fi
sed -i 's|log_error =.*|log_error = /var/log/mysql/error.log|g' /etc/mysql/my.cnf
if [ -f /etc/mysql/my.cnf ]; then
sed -i 's|log_error =.*|log_error = /var/log/mysql/error.log|g' /etc/mysql/my.cnf
fi
fi
turn_on_rsys_logging
else
@ -207,7 +209,9 @@ else
if [ -f /var/log/mysql.log ]; then
shred -zu /var/log/mysql.log
fi
sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf
if [ -f /etc/mysql/my.cnf ]; then
sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf
fi
fi
if [ -f /etc/fail2ban/fail2ban.conf ]; then
sed -i 's|loglevel.*|loglevel = 1|g' /etc/fail2ban/fail2ban.conf