logrotate meiner instances

/var/www/vhosts/instances/*/logs/*.log {
    daily
    missingok
    rotate 7
    compress
    delaycompress
    notifempty
    copytruncate
    sharedscripts
    maxsize 100M
    postrotate
        # Apache Reload
        if pidof apache2 > /dev/null; then
            systemctl reload apache2 > /dev/null 2>&1 || true
        fi

        # PHP-FPM Reload
        if pidof php8.3-fpm > /dev/null; then
            systemctl reload php8.3-fpm > /dev/null 2>&1 || true
        fi

        # PHP-FPM Reload
        if pidof php8.4-fpm > /dev/null; then
            systemctl reload php8.4-fpm > /dev/null 2>&1 || true
        fi

        # Redis hat normalerweise keine Logrotation notwendig, reload optional:
        if pidof redis-server > /dev/null; then
            systemctl reload redis-server > /dev/null 2>&1 || true
        fi
    endscript
}

Zurück