Skip to content

Instantly share code, notes, and snippets.

@rooty
Created March 23, 2018 09:21
Show Gist options
  • Save rooty/f991e110af0c7c168c5bba0b1accd779 to your computer and use it in GitHub Desktop.
Save rooty/f991e110af0c7c168c5bba0b1accd779 to your computer and use it in GitHub Desktop.
Manipulate date
/var/log/myproject/celery.log {
size 1
su myuser myuser
copytruncate
create
rotate 10
missingok
postrotate
timeext=`date -d '1 day ago' "+%Y-%m-%d"` # daily
# timeext=$(date +%Y-%m-%d_%H) # hourly
mv /var/log/myproject/celery.log.1 /var/log/myproject/archive/celery_$timeext.log
endscript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment