1
0
Fork 0
mirror of https://github.com/myvesta/vesta synced 2025-08-14 18:49:21 -07:00

Handling tailf watcher processes in v-clean-garbage

This commit is contained in:
myvesta 2023-08-23 11:23:57 +02:00 committed by GitHub
commit c32036e531
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 19 deletions

View file

@ -21,6 +21,14 @@ source /usr/local/vesta/func/main.sh
# Action #
#----------------------------------------------------------#
# turn off tailf watcher process
if [ -f "/usr/local/bin/tailf_apache_error.php" ]; then
kill $(ps aux | grep 'tailf_apache_error' | grep -v "grep tailf_apache_error" | awk '{print $2}')
fi
if [ -f "/usr/local/bin/tailf_exim.php" ]; then
kill $(ps aux | grep 'tailf_exim' | grep -v "grep tailf_exim" | awk '{print $2}')
fi
rm /var/backups/* > /dev/null 2>&1
rm /var/cache/apt/archives/* > /dev/null 2>&1
cd /var/log
@ -41,6 +49,9 @@ find /var/log/ -name "*.gz" -type f -delete
find /usr/local/vesta/log/ -type f -name "*.log" -exec truncate -s 0 {} \;
find /usr/local/vesta/log/ -type f -not -name "*.log" -delete
find /var/log/exim4/ -type f -exec truncate -s 0 {} \;
truncate -s 0 /*.log
rm /panic-*.log
rm /var/log/panic-*.log
clean_home() {
nice -n 19 ionice -c 3 find $1/*/tmp/ -type f -delete
@ -74,6 +85,14 @@ if [ $fail2ban_running -eq 1 ]; then
systemctl start fail2ban
fi
# turn on tailf watcher process
if [ -f "/usr/local/bin/tailf_apache_error.php" ]; then
nohup php /usr/local/bin/tailf_apache_error.php > /var/log/tailf_apache_error.log &
fi
if [ -f "/usr/local/bin/tailf_exim.php" ]; then
nohup php /usr/local/bin/tailf_exim.php > /var/log/tailf_exim.log &
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#

View file

@ -354,32 +354,13 @@ do
echo "============================="
echo "== cleaning trash"
df -m
ps -Af | grep tailf | grep -v "grep tailf"
if [ -f "/usr/local/bin/tailf_apache_error.php" ]; then
kill $(ps aux | grep 'tailf_apache_error' | grep -v "grep tailf_apache_error" | awk '{print $2}')
fi
if [ -f "/usr/local/bin/tailf_exim.php" ]; then
kill $(ps aux | grep 'tailf_exim' | grep -v "grep tailf_exim" | awk '{print $2}')
fi
echo "------"
ps -Af | grep tailf | grep -v "grep tailf"
echo "------"
sleep 2
truncate -s 0 /*.log
rm /panic-*.log
rm /var/log/panic-*.log
/usr/local/vesta/bin/v-clean-garbage
sleep 2
if [ -f "/usr/local/bin/tailf_apache_error.php" ]; then
nohup php /usr/local/bin/tailf_apache_error.php > /var/log/tailf_apache_error.log &
fi
if [ -f "/usr/local/bin/tailf_exim.php" ]; then
nohup php /usr/local/bin/tailf_exim.php > /var/log/tailf_exim.log &
fi
echo "--------------"
df -m
echo "--------------"
sleep 2
ps -Af | grep tailf | grep -v "grep tailf"
fi