Jump to content

unix vallantha okasari itu randi


Recommended Posts

Posted

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 chesthunde

LOG_FILE=`find /home/Logdir -name "*.log" -mtime +1 -exec ls -lrt {} \; | awk '{print $9}'`
for FILE in LOG_FILE
do
rm ${FILE}
done

But ippudu only 2hrs mundu files delete cheyali, so solaris lo -mmin use chesthe workout avat ledhu. Please evarina help cheyandi, asap.

Thanks in advance!!!

  • Replies 47
  • Created
  • Last Reply

Top Posters In This Topic

  • PMREDDY19

    14

  • gunnerz4ever

    13

  • celebrate

    12

  • Gachibowli_Diwakar

    4

Top Posters In This Topic

Posted

sorry2
PMreddy gaaru may be u can help him  sSc_hiding2 sSc_hiding2

Posted

[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..

Posted

c drive nunchi present vunna drive ke ela copy cheyalo unix lo konchem chepandi babu  sFun_duh sFun_duh

Posted

[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

Posted

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...

Posted

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 { } \ ;
Posted

[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

Posted

[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??

Posted

[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 chesthunde

LOG_FILE=`find /home/Logdir -name "*.log" -mtime +1 -exec ls -lrt {} \; | awk '{print $9}'`
for FILE in LOG_FILE
do
rm ${FILE}
done

But 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 akkada


As 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  -  86399
1 day in seconds:    86400  -  172799
2 days in seconds:  172800  -  259159

So 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, ...}

Posted

[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

Posted

[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 chesthunde

LOG_FILE=`find /home/Logdir -name "*.log" -mtime +1 -exec ls -lrt {} \; | awk '{print $9}'`
for FILE in LOG_FILE
do
rm ${FILE}
done

But 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

Posted

[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 akkada


As 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  -  86399
1 day in seconds:    86400  -  172799
2 days in seconds:  172800  -  259159

So 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...

Posted

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..

Posted

nope touch command ledhu.,

@ PMREDDY: Hey actually these are huge files so manual ga cheyalekapothunnanu but something time stamp tho rasthunnanu script...

×
×
  • Create New...