PMREDDY19 Posted March 17, 2011 Report Posted March 17, 2011 [quote author=celebrate link=topic=168755.msg2042602#msg2042602 date=1300335969]nope touch command ledhu.,@ PMREDDY: Hey actually these are huge files so manual ga cheyalekapothunnanu but something time stamp tho rasthunnanu script... [/quote]huge files but number of files???
Gachibowli_Diwakar Posted March 17, 2011 Report Posted March 17, 2011 if mtime +1 removes for 1 day.. why dont you give a try with mtime +1/12 its just a simple math kadha mama
gunnerz4ever Posted March 17, 2011 Report Posted March 17, 2011 try this one LOG_FILE=`find /home/Logdir -name "*.log" -mtime +1 -exec ls -lrt {} \; | awk '{print $9}'`for FILE in LOG_FILEdorm ${FILE}done
celebrate Posted March 17, 2011 Author Report Posted March 17, 2011 [quote author=PMREDDY19 link=topic=168755.msg2042631#msg2042631 date=1300336222]huge files but number of files???[/quote]Space is fine but the logs are more than 500 hourly, actually ivi incoming logs for which current logs processing kosam need to rm files....
PMREDDY19 Posted March 17, 2011 Report Posted March 17, 2011 [quote author=PMREDDY19 link=topic=168755.msg2042598#msg2042598 date=1300335920]looks like mtime is using the number of days dude...we may need to use the number of days only ..so lets check if find . -mtime +0.25 -exec rm -r { } \ ; try chesi chuddali if possible..on some test folder..[/quote]not accepting +0.25
Gachibowli_Diwakar Posted March 17, 2011 Report Posted March 17, 2011 [quote author=gunnerz4ever link=topic=168755.msg2042677#msg2042677 date=1300336669]try this one LOG_FILE=`find /home/Logdir -name "*.log" [b][size=12pt][color=red]-mtime +1[/color][/size][/b] -exec ls -lrt {} \; | awk '{print $9}'`for FILE in LOG_FILEdorm ${FILE}done[/quote]that deletes the files which are 1day older
PMREDDY19 Posted March 17, 2011 Report Posted March 17, 2011 [quote author=celebrate link=topic=168755.msg2042681#msg2042681 date=1300336696]Space is fine but the logs are more than 500 hourly, actually ivi incoming logs for which current logs processing kosam need to rm files....[/quote]meeku logs rotation ki emi script ledha in place like whenever u run the script all the old logs move to a different folder after compressed kindoff../
gunnerz4ever Posted March 17, 2011 Report Posted March 17, 2011 this is for for every 2 hrs find . -name "*.log[0-9]*" -o -name "*.log" -mtime +3 |xargs rm -fR {} \;
Gachibowli_Diwakar Posted March 17, 2011 Report Posted March 17, 2011 [quote author=gunnerz4ever link=topic=168755.msg2042694#msg2042694 date=1300336821]this is for for every 2 hrs find . -name "*.log[0-9]*" -o -name "*.log" -mtime +3 |xargs rm -fR {} \;[/quote]mtime ante machine time kadha mama .. so that script deletes files which are older than 3dayshe needs to use mmin instead of mtime I guess
gunnerz4ever Posted March 17, 2011 Report Posted March 17, 2011 find /tmp/ -type f -mmin 30 -exec rm {} \;this is for 30 mins ago
gunnerz4ever Posted March 17, 2011 Report Posted March 17, 2011 find /tmp/ -type f -mmin 30 -exec rm {} \;to remove files that have been modified from 30 minutes ago.mtime remove files n*24 hours old, mmin n minutes old (where n is the number that you pass after the parameter mmin or mtime)
celebrate Posted March 17, 2011 Author Report Posted March 17, 2011 @PMReddy you are correct decimals thesukovatledhu....@gunnerz4ever & Musugu_Veerudu : solarils lo find: bad option -mmin anni vasthundi....
gunnerz4ever Posted March 17, 2011 Report Posted March 17, 2011 or else try this one find $HOME/Log -type f -name "*.log" -amin +30 -exec ls {} \;
Gachibowli_Diwakar Posted March 17, 2011 Report Posted March 17, 2011 [quote author=celebrate link=topic=168755.msg2042762#msg2042762 date=1300337457]@PMReddy you are correct decimals thesukovatledhu....@gunnerz4ever & Musugu_Veerudu : solarils lo find: bad option -mmin anni vasthundi....[/quote]looks like you have to touch a file with date in it..and then call your script to delete the files older than date in it..man mtime .. or .. man mmin ani type cheyi.. if it says No manual.. it means those will not work
gunnerz4ever Posted March 17, 2011 Report Posted March 17, 2011 [quote author=celebrate link=topic=168755.msg2042762#msg2042762 date=1300337457]@PMReddy you are correct decimals thesukovatledhu....@gunnerz4ever & Musugu_Veerudu : solarils lo find: bad option -mmin anni vasthundi....[/quote]dude u should have told it before as it is a solaris box,question clarity ga unte fast ga answer ochedhi kada ,but let me try.
Recommended Posts