Skip to content

Instantly share code, notes, and snippets.

@tristan
Created August 16, 2012 08:27
Show Gist options
  • Save tristan/3368391 to your computer and use it in GitHub Desktop.
Save tristan/3368391 to your computer and use it in GitHub Desktop.
Log rotate/cleanup script
#!/bin/bash
BASE_DIR=/tmp
mv $BASE_DIR/couchdb.log $BASE_DIR/couchdb-`date +%Y-%m-%d -d 'yesterday'`.log
touch $BASE_DIR/couchdb.log
LAST_WEEK=$BASE_DIR/couchdb-`date +%Y-%m-%d -d '8 days ago'`.log
if [ -a $LAST_WEEK ]
then
rm $LAST_WEEK
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment