Re: close file descriptor on other process
From: James Cooley (jcooley_at_fit.edu)
Date: 03/17/05
- Previous message: Anson Chan: "close file descriptor on other process"
- In reply to: Anson Chan: "close file descriptor on other process"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 16 Mar 2005 23:06:38 -0500 (EST) To: "General Red Hat Linux discussion list" <redhat-list@redhat.com>
A lot of processes respond to a hangup signal, and release and regrab file
descriptors without shutting down. You just do a kill -HUP pid and it
should do the trick. Athough I highly doubt the -HUP signal would cause
any problem, you may want to wait until a time where it wouldn't cause as
many problems if it did cause a problem with the process.
You might be able to find info in the applications documentation about
whether or not it responds to a hangup.
Doing a kill -HUP on a process is how many systems handle rotating logfiles:
move logfile
create new logfile
kill -HUP the process so it releases the handle on the old file and grabs
the new file
--James Cooley
> Hi All,
>
> I have a process which has opened about ten files but
> only one of them is currently in use. Each of these
> ten files is quite large (about 100MB per each file)
> and the partition is getting full now (80% full).
> Therefore, I use gzip to compress the other nine files
> to save some space. However, I found that the disk
> usage is not decreased but increased to 85% after
> gzip!
>
> When I use lsof to check the files opened by that
> process, it shows some files are marked deleted as
> below
>
> tecs 17138 tecs 9w REG 104,3 113490637
> 98458 /logs/output.log.20050308 (deleted)
>
> The system is still holding the file descriptors and
> not released. What should I do to free the space? I
> cannot stop the process because it is on production
> now.
>
> If I use cp /proc/17138/fd/9 to
> /logs/output.log.20050308, it will
> recover the original file, but lsof still shows
> deleted. Therefore, I cannot use cat /dev/null >
> /logs/output.log.20040308 to truncate the file.
> Is there any method which can recover the original
> file such that I can truncate it and save the disk
> space?
>
> Or, how do I close the file descriptor on other
> process without stopping the process (assumed that I
> have root priviledge)?
>
> Thanks in advance.
>
> Anson
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>
-- redhat-list mailing list unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list
- Previous message: Anson Chan: "close file descriptor on other process"
- In reply to: Anson Chan: "close file descriptor on other process"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|