Skip to content

Instantly share code, notes, and snippets.

@aaronwalker
Created December 9, 2010 23:44
Show Gist options
  • Select an option

  • Save aaronwalker/735524 to your computer and use it in GitHub Desktop.

Select an option

Save aaronwalker/735524 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "x$JBOSS_HOME" = "x" ]; then
JBOSS_HOME="/opt/apps/jboss/current/jboss-as"
fi
if [ "x$JBOSS_SERVER" = "x" ]; then
JBOSS_SERVER="default"
fi
JBOSS_LOG_DIR="$JBOSS_HOME/server/$JBOSS_SERVER/log"
JBOSS_BACKUP_DIR="$JBOSS_LOG_DIR/backup"
if [[ ! -e $JBOSS_BACKUP_DIR ]]; then
mkdir $JBOSS_BACKUP_DIR
fi
for file in `find $JBOSS_LOG_DIR -mtime +3 -name \*\.log\.????-??-??`
do
#compress the log file
bzip2 $file
#move to the backup directory
mv $file.bz2 $JBOSS_BACKUP_DIR
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment