Golden Codes - armanexplorer planet

Practical code snippets for Django, Python, Bash, Git and All!

View on GitHub

config

cat <<EOF > /etc/logrotate.d/myapp
/path/to/myapp/logs/*.log {
    daily
    rotate 52
    compress
    delaycompress
    notifempty
    missingok
    create 0644 root root
    postrotate
        [ ! -f /var/run/myapp.pid ] || kill -USR1 `cat /var/run/myapp.pid`
    endscript
}

run manual rotation

# force rotate
logrotate -f /etc/logrotate.d/myapp

# add detaied output
logrotate -vf /etc/logrotate.d/myapp

# run in debug mode (nothing will happen but printing)
logrotate -d /etc/logrotate.d/myapp

multi-path (WORKED!)

Ref