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 if [ ! -d /var/log/mysql ]; then
mkdir /var/log/mysql mkdir /var/log/mysql
fi 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 fi
turn_on_rsys_logging turn_on_rsys_logging
else else
@ -207,7 +209,9 @@ else
if [ -f /var/log/mysql.log ]; then if [ -f /var/log/mysql.log ]; then
shred -zu /var/log/mysql.log shred -zu /var/log/mysql.log
fi 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 fi
if [ -f /etc/fail2ban/fail2ban.conf ]; then if [ -f /etc/fail2ban/fail2ban.conf ]; then
sed -i 's|loglevel.*|loglevel = 1|g' /etc/fail2ban/fail2ban.conf sed -i 's|loglevel.*|loglevel = 1|g' /etc/fail2ban/fail2ban.conf