Skip to content

Instantly share code, notes, and snippets.

@neuro-sys
Created February 18, 2013 11:19
Show Gist options
  • Select an option

  • Save neuro-sys/4976698 to your computer and use it in GitHub Desktop.

Select an option

Save neuro-sys/4976698 to your computer and use it in GitHub Desktop.
log rotate db2
13:12 neuro_sys -rw------- 1 db2inst1 db2inst1 4104192 2010-05-14 14:23 S0000001.MIG
13:12 [user] rollover is set by fs, when size is reached, new log is created
13:12 [user] in that case
13:12 [user] why not gzip them all anyway?
13:12 [user] i man, it's there, just compresed
13:13 neuro_sys did that already
13:13 neuro_sys so I'm on safe grouns
13:13 neuro_sys now moving the old logs to another partition
13:13 [user] just a sec
13:13 [user] i'll give you a neat command
13:14 [user] find $DB2_LOGS_LOCATION -name "S000*" -mtime +30 -print -exec gzip -c {} \;
13:14 [user] put to crontab
13:15 [user] to execute daily
13:15 neuro_sys awesome man, thanks
13:15 [user] if file is older than 30 days, automatically it's compressed
13:15 [user] or modify the time, maybe 15 days or so
13:15 [user] dont forget to input $DB2_LOGS_LOCATION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment