summaryrefslogtreecommitdiffstats
path: root/abs/core/runit-scripts/runitscripts/services
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/runit-scripts/runitscripts/services')
-rwxr-xr-xabs/core/runit-scripts/runitscripts/services/mysql/run9
1 files changed, 9 insertions, 0 deletions
diff --git a/abs/core/runit-scripts/runitscripts/services/mysql/run b/abs/core/runit-scripts/runitscripts/services/mysql/run
index de76962..8fad493 100755
--- a/abs/core/runit-scripts/runitscripts/services/mysql/run
+++ b/abs/core/runit-scripts/runitscripts/services/mysql/run
@@ -35,6 +35,15 @@ if [ ! -d /var/run/mysqld ]; then
mkdir -p /var/run/mysqld
chown mysql /var/run/mysqld
fi
+
+#check .err and truncate if more than 30000 lines
+ErrFile="/data/srv/mysql/`hostname`.err"
+if [[ $(wc -l < $ErrFile) -gt 30000 ]]
+then
+ tail -n 30000 "$ErrFile" > "$ErrFile.tmp" && mv "$ErrFile.tmp" "$ErrFile"
+ chown mysql.mysql "$ErrFile"
+fi
+
HOME=/etc/mysql/
MYSQLADMIN='/usr/bin/mysqladmin'