Рубрики
bash

Удалялка папок для бэкапа

#!/bin/bash

/usr/bin/find /storage/config -mindepth 1 -maxdepth 1 -ctime +2 -type d | sort -n | head -n-3 | while read LINE; do
    echo "[/storage/zimbra/config] ${LINE}"
    rm -rf "${LINE}"
done

/usr/bin/find /storage/mailbox/daily -mindepth 1 -maxdepth 1 -ctime +1 -type d | sort -n | head -n-1 | while read LINE; do
    echo "[/storage/zimbra/mailbox/daily] ${LINE}"
    rm -rf "${LINE}"
done

/usr/bin/find /storage/mysql -mindepth 1 -maxdepth 1 -ctime +1 -type d | sort -n | head -n-3 | while read LINE; do
    echo "[/storage/mysql] ${LINE}"
    rm -rf "${LINE}"
done

/usr/bin/find /storage/mysql-full -mindepth 1 -maxdepth 1 -ctime +1 -type d | sort -n | head -n-3 | while read LINE; do
    echo "[/storage/mysql-full] ${LINE}"
    rm -rf "${LINE}"
done