Help needed desperately


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed desperately
# 1  
Old 02-22-2009
Help needed desperately

Hello Folks,

i have written a script to nullify the log files in my dev environment but the log files are not getting nullified.Please find below my script and also thank you all in advance for your help.


find /app -size +100000 -xdev -exec du -k {} \; 2>/dev/null | sort -nr |ls -1dF /app/apal/obl/obcl*/logs/apa_[0-9]*.log > /tmp/RR0
cat RR0 | cut -d"/" -f1-5 > /tmp/RR1

for RR2 in 'cat /tmp/RR1'
do
cd {$RR2}
echo 'pwd'
if[ -f apache_[0-9]*.log ]
> apa_[0-9]*.log
fi



let me knw if u want some other detail in this regard?
# 2  
Old 02-22-2009
Quote:
Originally Posted by Rayzone
i have written a script to nullify the log files in my dev environment but the log files are not getting nullified.
You could:
Code:
find /app -size +100000 -iname apa\*.log 2>/dev/null | xargs -t -iF echo rm 'F' 2>&1 \
| awk '{print $2}' | xargs -iF echo touch 'F'

...but that misses out on setting ownership and DAC rights, so you could:
Code:
find /app -size +100000 -iname apa\*.log 2>/dev/null | while read FILENAME; do $>"$FILENAME"; done

...however if an application keeps the log open you would have to stop it, zap the log then start it again..
Code:
# ...and that's why using logrotate often works better than reinventing the wheel... ;-p

Logrotate can act on log size, run single-shot or cronjobbed, has pre/postscripts to stop/start services, et cetera.
# 3  
Old 02-22-2009
what is the iname option stands in the find command?

is it inode no...?



i have given a try of the above find cmd which u have given,
but it doesn't display any list of log files?

find /app -size +100000 -iname /app/apache/oblix/obcls*/logs/apache_[0-9]*.log 2>/dev/null


what this above cmd will do?


Thanks in advance
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help needed on If Else

Hi, I am using "nc" command to test connectivity to Application ports. I am getting following outputs in case of success & failed scenarios & I am re-directing it to a file. FLPROVP02 4848 (?) open FLPROVP02 4849 (?) : Connection refused My script is as below. #!/bin/bash cd... (2 Replies)
Discussion started by: SunilB2011
2 Replies

2. Shell Programming and Scripting

Expect Scripting Loop Argument Desperately Needed!

I am trying to create an Expect script that does the following: 1) Telnets to an IP address and logs in with user ID and Password 2) Issue a CLI command to the server that will output data of which I am particularly interested in a DS1 clock 'Slips' value. I want to be able to keep issuing... (0 Replies)
Discussion started by: dwightlaidler
0 Replies

3. UNIX for Dummies Questions & Answers

UNIX advice needed desperately :/

Firstly I do need to state that I am turning here as a last resort. Im in my first year of a Computer Networking and technical support course, and as a first year I must complete a Introductory Unix/Linux class. I have been doing well in the course so far however I have been stumped on the final... (1 Reply)
Discussion started by: setaylor5
1 Replies

4. Shell Programming and Scripting

Help Needed

please reply for this https://www.unix.com/shell-programming-scripting/111493-cutting-lines.html its really urgent (1 Reply)
Discussion started by: jojo123
1 Replies

5. Shell Programming and Scripting

Help needed desperately......

Hi guys, I want to execute an SQL script based on a condition.... I am writing a sample requirement... num = {some value} if(num == 0) then cat>> test.sql <<FIN select * from table_a FIN else cat>> test.sql << FIN select * from table_b FIN fi This is what i... (3 Replies)
Discussion started by: Payal Sharma
3 Replies

6. Shell Programming and Scripting

help needed...

Guys, There is a file where there are 1000s of records. In the file if some condition satisfies in a certain TAB record (TAB would be first 3 digits of a certain record) then move TAB and all the records (or lines) after TAB to new_file, until another TAB record is encountered in the same... (1 Reply)
Discussion started by: Prat007
1 Replies

7. UNIX for Dummies Questions & Answers

Help needed please.

i've been given an assignment to Write a system utility called recycle that satisfies the following requirements as they might be displayed in a UNIX/Linux man page: NAME recycle - stores files in a recycle bin SYNOPSIS recycle ... DESCRIPTION Recycle is a replacement for the... (3 Replies)
Discussion started by: jerryboy78
3 Replies

8. Shell Programming and Scripting

help needed

aaabbbcccd (1 Reply)
Discussion started by: hateshellscript
1 Replies

9. Shell Programming and Scripting

Help needed

Hi, I am beginner writing shell script i am using korn shell. I wrote shell script through which i am passing system date as parameter to build.xml file but i need to write a function when i pass systemdate as parameter the function has to return its respective quarterly date . Can any one... (0 Replies)
Discussion started by: connectpramod
0 Replies

10. Shell Programming and Scripting

Desperately Need Help On This Perl script

ok, i dont know any perl. actually, very very little. not much at all. now, the task i have is that i have to go into a directory that is packed with hundreds of files that contains lots of strings of which i have to filter through. so when i get into this directory, i type: grep -r akamai... (19 Replies)
Discussion started by: Terrible
19 Replies
Login or Register to Ask a Question