User Tools

Site Tools


custom_log_rotate_script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

custom_log_rotate_script [2009/06/04 15:01] – created k2patelcustom_log_rotate_script [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-==== Custom Log rotate script ==== 
- 
-<code bash | custlogrotate.sh> 
-#!/bin/sh 
- 
-yesterday=`date -v-1d '+%Y%m%d'` 
- 
-mkdir /home/log/log.$yesterday 
- 
-for i in `ls /home/log | grep $yesterday` 
-do 
-echo $i 
-mv $i /home/log/log.$yesterday 
-done 
- 
-tar -cvf /home/log/log$yesterday.tar.gz /home/log/log.$yesterday 
-rm -rf /home/log/log.$yesterday 
-chown -R user:group /home/log 
-</code> 
  
custom_log_rotate_script.1244127675.txt.gz · Last modified: 2020/08/10 02:29 (external edit)