celebrate Posted March 17, 2011 Report Posted March 17, 2011 hello,Actually nenu log files rm cheyali so inthaka mundu unna req lo past 24hrs kante mundu unna files ni delete cheyali so daaniki below script use chesthundeLOG_FILE=`find /home/Logdir -name "*.log" -mtime +1 -exec ls -lrt {} \; | awk '{print $9}'`for FILE in LOG_FILEdorm ${FILE}doneBut ippudu only 2hrs mundu files delete cheyali, so solaris lo -mmin use chesthe workout avat ledhu. Please evarina help cheyandi, asap.Thanks in advance!!!
Cheddi Chinnodu Posted March 17, 2011 Report Posted March 17, 2011 sorry2 PMreddy gaaru may be u can help him sSc_hiding2 sSc_hiding2
PMREDDY19 Posted March 17, 2011 Report Posted March 17, 2011 [quote author=Cheddi Chinnodu link=topic=168755.msg2042347#msg2042347 date=1300333727] sorry2 PMreddy gaaru may be u can help him sSc_hiding2 sSc_hiding2[/quote]looking into it now..
K.A.Paul Posted March 17, 2011 Report Posted March 17, 2011 c drive nunchi present vunna drive ke ela copy cheyalo unix lo konchem chepandi babu sFun_duh sFun_duh
Cheddi Chinnodu Posted March 17, 2011 Report Posted March 17, 2011 [quote author=K.A.Paul link=topic=168755.msg2042367#msg2042367 date=1300333900]c drive nunchi present vunna drive ke ela copy cheyalo unix lo konchem chepandi babu sFun_duh sFun_duh[/quote]cp C:\filename . sSc_hiding2 sSc_hiding2
celebrate Posted March 17, 2011 Author Report Posted March 17, 2011 Thanks for you reply!!!@ PMReddy gaaru nen actually idi try chesthunde find . -name "filename" -mmin +240 -exec rm * {} \;but -mmin command not found anni osthundi... so alternate option ela try cheyocho chepthara please...
PMREDDY19 Posted March 17, 2011 Report Posted March 17, 2011 To delete the files older than 2 days , I used this some time ago.. check it on some test folder by moving a tar folder and then use in main box..find . -mtime +2 -exec rm -r { } \ ;
K.A.Paul Posted March 17, 2011 Report Posted March 17, 2011 [quote author=Cheddi Chinnodu link=topic=168755.msg2042374#msg2042374 date=1300333956]cp C:\filename . sSc_hiding2 sSc_hiding2[/quote]cp command file ke kuda use avutunnddddaa sCo_hmmthink
celebrate Posted March 17, 2011 Author Report Posted March 17, 2011 [quote author=PMREDDY19 link=topic=168755.msg2042487#msg2042487 date=1300334977]To delete the files older than 2 days , I used this some time ago.. check it on some test folder by moving a tar folder and then use in main box..find . -mtime +2 -exec rm -r { } \ ;[/quote]Hey Thank you, but here i need to delete logs which are more than 2hours old., actually file frequecy perigindi so every 2hr kante mundu unna anni logs delete cheyali :( so inka ela try cheyochu any idea??
PMREDDY19 Posted March 17, 2011 Report Posted March 17, 2011 [quote author=celebrate link=topic=168755.msg2042334#msg2042334 date=1300333632]hello,Actually nenu log files rm cheyali so inthaka mundu unna req lo past 24hrs kante mundu unna files ni delete cheyali so daaniki below script use chesthundeLOG_FILE=`find /home/Logdir -name "*.log" -mtime +1 -exec ls -lrt {} \; | awk '{print $9}'`for FILE in LOG_FILEdorm ${FILE}doneBut ippudu only 2hrs mundu files delete cheyali, so solaris lo -mmin use chesthe workout avat ledhu. Please evarina help cheyandi, asap.Thanks in advance!!![/quote]neeku past 2 hrs kavali annavu kada, let me look into for past 2 hrs.. [quote author=celebrate link=topic=168755.msg2042407#msg2042407 date=1300334284]Thanks for you reply!!!@ PMReddy gaaru nen actually idi try chesthunde find . -name "filename" -mmin +240 -exec rm * {} \;but -mmin command not found anni osthundi... so alternate option ela try cheyocho chepthara please...[/quote]Idhi chudu okasari [url=http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html]http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html[/url] lesss than a day antey edho undi akkadaAs you probably know, the find command can run for minutes or hours depending on the size of the filesystem being searched. The find command makes a note of its own start time. It then looks at a file's mtime and computes how many seconds ago the file was modified. By dividing the seconds by 86,400 (and discarding any remainder), it can calculate the file's age in days: Code:0 days in seconds: 0 - 863991 day in seconds: 86400 - 1727992 days in seconds: 172800 - 259159So now that we know how many days ago a file was modified, we can use stuff like "-mtime 2" which specifies files that are 172800 to 259159 seconds older than the instant that the find command was started. "-mtime -2" means files that are less than 2 days old, such as a file that is 0 or 1 days old."-mtime +2" means files that are more than 2 days old... {3, 4, 5, ...}
PMREDDY19 Posted March 17, 2011 Report Posted March 17, 2011 [quote author=celebrate link=topic=168755.msg2042528#msg2042528 date=1300335339]Hey Thank you, but here i need to delete logs which are more than 2hours old., actually file frequecy perigindi so every 2hr kante mundu unna anni logs delete cheyali :( so inka ela try cheyochu any idea??[/quote]a bunch of files form avutunnavya ippudu already .//mari urgent ithey matram ..ls -lart kotti latest unchesi ... old files ni lepeseyyi if they are consuming the disk space as of now....meanwhile I will try to find the script exactl;y
Minister Posted March 17, 2011 Report Posted March 17, 2011 [quote author=celebrate link=topic=168755.msg2042334#msg2042334 date=1300333632]hello,Actually nenu log files rm cheyali so inthaka mundu unna req lo past 24hrs kante mundu unna files ni delete cheyali so daaniki below script use chesthundeLOG_FILE=`find /home/Logdir -name "*.log" -mtime +1 -exec ls -lrt {} \; | awk '{print $9}'`for FILE in LOG_FILEdorm ${FILE}doneBut ippudu only 2hrs mundu files delete cheyali, so solaris lo -mmin use chesthe workout avat ledhu. Please evarina help cheyandi, asap.Thanks in advance!!![/quote]You may have to touch a file once in every 2 hrs and then get all the files older than that file. I am not sure if "touch" is available in solaris. But its available in AIX
celebrate Posted March 17, 2011 Author Report Posted March 17, 2011 [quote author=PMREDDY19 link=topic=168755.msg2042537#msg2042537 date=1300335369]neeku past 2 hrs kavali annavu kada, let me look into for past 2 hrs.. Idhi chudu okasari [url=http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html]http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html[/url] lesss than a day antey edho undi akkadaAs you probably know, the find command can run for minutes or hours depending on the size of the filesystem being searched. The find command makes a note of its own start time. It then looks at a file's mtime and computes how many seconds ago the file was modified. By dividing the seconds by 86,400 (and discarding any remainder), it can calculate the file's age in days: Code:0 days in seconds: 0 - 863991 day in seconds: 86400 - 1727992 days in seconds: 172800 - 259159So now that we know how many days ago a file was modified, we can use stuff like "-mtime 2" which specifies files that are 172800 to 259159 seconds older than the instant that the find command was started. "-mtime -2" means files that are less than 2 days old, such as a file that is 0 or 1 days old."-mtime +2" means files that are more than 2 days old... {3, 4, 5, ...}[/quote]I Seriously appreciate your help!! Try chesthunnanu but choodali how far i can make it.... in the mean while meeku edina thelusthe cheppandi...
PMREDDY19 Posted March 17, 2011 Report Posted March 17, 2011 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..
celebrate Posted March 17, 2011 Author Report Posted March 17, 2011 nope touch command ledhu.,@ PMREDDY: Hey actually these are huge files so manual ga cheyalekapothunnanu but something time stamp tho rasthunnanu script...
Recommended Posts