Added cleaning logs to discard older logs as not need while developing
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Variables
|
||||
LOG_DIR="/var/log/apache2"
|
||||
ERROR_LOG="${LOG_DIR}/error.log"
|
||||
ACCESS_LOG="${LOG_DIR}/access.log"
|
||||
LINES_TO_KEEP=50
|
||||
|
||||
# Truncate logs to keep only the last 50 lines
|
||||
tail -n $LINES_TO_KEEP $ERROR_LOG > ${ERROR_LOG}.tmp && mv ${ERROR_LOG}.tmp $ERROR_LOG
|
||||
tail -n $LINES_TO_KEEP $ACCESS_LOG > ${ACCESS_LOG}.tmp && mv ${ACCESS_LOG}.tmp $ACCESS_LOG
|
||||
Reference in New Issue
Block a user