Log file grows


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Log file grows
# 1  
Old 11-26-2012
Log file grows

I am having the script works as below
If the folder is not create, the file are stored in a temporary folder to wait for the folder creation.
The Script tries and tries again to reach the folder.
The result is that the log file grows and some time is also geting wasted in the operation.

can somebody please advise or help on how to come up with this situation or restrict it. file writing log to file.

below is the sample script.
Code:
cd  $mywaitdir
for file in $(find . -type f -name "*" | grep -i zip )
do

 filedest=${myroot}/`dirname $file`
if [ -d ${filedest} ]
   then
      mv $file $filedest
      if [ $? -eq 0 ]
      then
         if [ "$DEBUG" != "Y" ]
         then
            rm -f $file
         fi
      fi
else 
echo "$date ERROR folder does not exist>> mynofolder.log
fi
done

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by vbe; 11-26-2012 at 11:58 AM.. Reason: code tags please
# 2  
Old 11-26-2012
Simply don't log the message if the directory does not exist?
Or did I understand something wrong?
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Solaris

solaris 10u9 + sendmail 8.14.5 mailq grows, deferred messages

hello, I am using solaris 10 and sendmail 8.14.5 Main Problem i have growing (to 1500+ mails) mailq, and mailq consists of mails older then even 1 month. i have forced mailq by sendmail -q -v and messages went out. but it looks like, when messages enter to mailq they are not processed any... (0 Replies)
Discussion started by: lpic.lt
0 Replies

2. Shell Programming and Scripting

Capture all error message in Log file and send the Log file by email

Hi I have a requirement to write a script to capture all errors in a Logfile and send the file in email. If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS. So I created a Log file and put the Appropriate... (2 Replies)
Discussion started by: dgmm
2 Replies

3. Shell Programming and Scripting

Delete log file entries based on the Date/Timestamp within log file

If a log file is in the following format 28-Jul-10 ::: Log message 28-Jul-10 ::: Log message 29-Jul-10 ::: Log message 30-Jul-10 ::: Log message 31-Jul-10 ::: Log message 31-Jul-10 ::: Log message 1-Aug-10 ::: Log message 1-Aug-10 ::: Log message 2-Aug-10 ::: Log message 2-Aug-10 :::... (3 Replies)
Discussion started by: vikram3.r
3 Replies

4. Shell Programming and Scripting

Rename a log file to old, then create a new log file.

Hi all, I have about 15 directories all with exactly the same structure. I have a file in each of them called log.txt. This file sits in /home/ftp/*usernamehere*/ftptransfer/log/ Username here is the only change in each of the 15 directories. I want to create a SIMPLE shell script that... (5 Replies)
Discussion started by: mokachoka
5 Replies

5. Shell Programming and Scripting

Rename log file according to log file age

Hi Experts, i am new in shell programming. i am having some problem of checking the log file age and rename it. for example: when i run the shell script, the script will check how old is the log file, if the log is already 10 days old(variable). then the log file will rename. hope to... (3 Replies)
Discussion started by: ewawong
3 Replies
Login or Register to Ask a Question