martes, 26 de noviembre de 2024

disk clean

Delete logs

 find /var/log/astguiclient -type f -mtime +1 -exec rm -f {} \;




Delete all   no time restrictions
/usr/bin/find /var/spool/asterisk/monitorDONE/ORIG -maxdepth 2 -type f -print | xargs rm -f

delete only mp3 files other  than  7 days running this cron every  9 days

0 0 */9 * * /usr/bin/find /var/spool/asterisk/monitorDONE/MP3 -maxdepth 2 -type f -name "*.mp3" -mtime +7 -exec rm -f {} \;


..............

#!/bin/bash

# Get the most recent binary log file name
latest_log=$(mysql -u root -e "SHOW BINARY LOGS;" | tail -n 1 | awk '{print $1}')

# Run FLUSH and PURGE BINARY LOGS
mysql -u root -e "FLUSH LOGS; PURGE BINARY LOGS TO '$latest_log';"












-------
./db_flush.sh

No hay comentarios:

Publicar un comentario