Yes, after you have deleted the file there is little you can do to recover the allocated space apart from killing and restarting the process(es) that have the file open.
As RudiC points out you are better off writing zero size to the logfile eg:
Or
As a long-term solution you should consider using the logrotate daemon to keep your logfile sizes down.
And don't be surprised if that doesn't work.
There are ways for applications to write to log files that create problems with that method. One of them is redirecting stderr/stdout by using ">>" shell redirection.
If those methods are used, filesystem-specific features can come into play.
There's a reason why operating systems provide robust, scalable logging facilities. Scalable logging is not something that can be done reliably without serious work.
So if your app is not well-designed, you may be stuck with "kill the app, clean up the log file, restart the app".
I am using Posix shell to write a script. The problem I am having is that when I use the read command to go through a file I lose the tabs. How can I keep this from happening? (1 Reply)
hi friends
I need a shell script which will do the following Task
Enter the month :
if you enter 1 then it ll show you last 1 month's (starting from today).log file in the current directry.
if you enter 4 then it ll show you last 4 month's (starting from today).log file in the current... (2 Replies)
hi
iam new of the ksh script.iwant in formation of how to call in logfile in
ksh scripts. if the meaning in ksh.
please help me
thanks
naveen.g (1 Reply)
Good afternoon! Im new at scripting and Im trying to write a script to
calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
I have a disk space issue on one of my unix servers.
it is showing 98% full.. i found the offending folder and removed it. but i have not reclaimed the disk space.
is there another command that i need ?
thank you in advance for any assistance. (4 Replies)
Hi,
I have a lengthy shell script and when I try to run it, It takes a lot of time and for about 25-30 mins and outputs this message xrealloc: cannot reallocate (23523666) bytes (0 bytes allocated). Along with this it is also displaying two other error messages. One is it is saying the... (3 Replies)
I there a way to figure out how part of a logfile got deleted? I know unix does not have a date created date so that makes things very difficult to tell if the file got deleted or not. Several thousand lines of my .bash_history somehow got deleted. I still have this in my .bashrc so I don't... (0 Replies)
Hi Team,
Have to write a shell script to pick only 1 hr logs from the generated logfile and send it to other logfile.
Thanks & Regards,
Indu (3 Replies)
Bonjour,
I've wrote a script to monitor a logfile in realtime. It is working almost perfeclty except for two things.
The script use the following technique :
tail -fn0 $logfile | \
while read line ; do
... some stuff
done
First one, I'd like a way to end the monitoring script if a... (3 Replies)
Hello,
OS version is Red Hat Enterprise Linux Server release 6.5 (Santiago).
In one of the filesystem some old files post clone are not getting removed even with 'rm'
# ls -ltr | grep meagpd_62.dbf
-rw-rw---- 1 oracle oinstall 34358697984 Sep 1 08:46 meagpd_62.dbf
# rm... (7 Replies)
Discussion started by: saharookiedba
7 Replies
LEARN ABOUT CENTOS
tailf
TAILF(1) User Commands TAILF(1)NAME
tailf - follow the growth of a log file
SYNOPSIS
tailf [OPTION] file
DESCRIPTION
tailf will print out the last 10 lines of a file and then wait for the file to grow. It is similar to tail -f but does not access the file
when it is not growing. This has the side effect of not updating the access time for the file, so a filesystem flush does not occur peri-
odically when no log activity is happening.
tailf is extremely useful for monitoring log files on a laptop when logging is infrequent and the user desires that the hard disk spin down
to conserve battery life.
Mandatory arguments to long options are mandatory for short options too.
-n, --lines=N, -N
output the last N lines, instead of the last 10.
-V, --version
Output version information and exit.
-h, --help
Display help and exit.
AUTHOR
This program was originally written by Rik Faith (faith@acm.org) and may be freely distributed under the terms of the X11/MIT License.
There is ABSOLUTELY NO WARRANTY for this program.
The latest inotify based implementation was written by Karel Zak (kzak@redhat.com).
SEE ALSO tail(1), less(1)AVAILABILITY
The tailf command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
util-linux February 2003 TAILF(1)