09-07-2007
Quote:
Originally Posted by
blowtorch
Sorry for the delayed reply. Truncate does not mean closing the file, the file will still be open and the process will still be writing to it. But the size of the file will be reduced to zero bytes (it will increase again when the process that is writing to the files does a write).
could you please give me an example with truncate to make it clear, because I am not sure how to use it ?
besides, is there any way to close a file that is open ?
thanks.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Is there any commands in UNIX, like isopen(),isclose() to know whether a file has been opened for read/write purpose.?
Thanks (3 Replies)
Discussion started by: Pal
3 Replies
2. UNIX for Dummies Questions & Answers
I have a UNIX daemon process that's been started by a parent process, an application server.
The behavior of this daemon process is to inherit and use the app
server's file descriptors (ports/sockets).
When I shutdown the app server, the daemon continues to run, because there may be other... (1 Reply)
Discussion started by: kunalashar
1 Replies
3. UNIX for Advanced & Expert Users
I am having a client/server application which will download files from server. If server has directories, it will create directories/sub directories and then download files. In this process, I observed that number of open files are more than 400 (which is approxmately same as number of dir/subdir... (1 Reply)
Discussion started by: satyam90
1 Replies
4. Windows & DOS: Issues & Discussions
I'm trying to setup a cron job for my brother that goes out to the web and retrieves an excel file and overwrites the existing copy on his desktop. The problem I'm facing is I have to kill the process (excel.exe) if the file is open while the batch file runs, otherwise, it will create another copy... (2 Replies)
Discussion started by: quattro20v
2 Replies
5. Solaris
Hi
want to know what file (descriptor+filename+socket) is being accessed by particular process on solaris.
Purpose : while running perf. test, needs to find where is the bottleneck.
We are providing concurrnet load for around 1 hr and needs to capture data related to file usage pattern... (1 Reply)
Discussion started by: raxitsheth
1 Replies
6. Programming
can someone provide an example, where if the parent process quits for any reason, then the child process will also close? (3 Replies)
Discussion started by: omega666
3 Replies
7. IP Networking
Hi,
I have read some forum theads about the open and close ports. some points are clear and it is not working on my machine or something am i missing?
I have commented out a port /etc/services, one application uses
then when i use the telnet <hostname> <port_blocked> it shows connected..... (1 Reply)
Discussion started by: balamv
1 Replies
8. Shell Programming and Scripting
Hi all,
I need a script to delete a large set of files from a directory under / based on an input file and want to redirect errors into separate file.
I have already prepared a list of files in the input file.
Kndly help me.
Thanks,
Prash (36 Replies)
Discussion started by: prash358
36 Replies
9. Shell Programming and Scripting
I would like to create the following script:
run a python script with setsid
python may or may not fail with exception
check if all of the group processes were terminated correctly
if not, kill the remaining processes
How can I do that?
Thanks a lot (3 Replies)
Discussion started by: ASF Studio
3 Replies
10. Shell Programming and Scripting
Hi Gurus,
I have an input like the one below. What i wanted to achieved is to create a select statement based from that information
INPUTInsert into table_name (col1,col2,col3,col4,col5,DATE1,DATE2,col6,col7,col8,col9,col10,col11) values (6752,14932156,24,'ALL','Staff',to_date('04/17/2017... (6 Replies)
Discussion started by: ernesto
6 Replies
LEARN ABOUT REDHAT
remove
REMOVE(3) GNU REMOVE(3)
NAME
remove - delete a name and possibly the file it refers to
SYNOPSIS
#include <stdio.h>
int remove(const char *pathname);
DESCRIPTION
remove deletes a name from the filesystem. It calls unlink for files, and rmdir for directories.
If the removed name was the last link to a file and no processes have the file open the file is deleted and the space it was using is made
available for reuse.
If the name was the last link to a file but any processes still have the file open the file will remain in existence until the last file
descriptor referring to it is closed.
If the name referred to a symbolic link the link is removed.
If the name referred to a socket, fifo or device the name for it is removed but processes which have the object open may continue to use
it.
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
EFAULT pathname points outside your accessible address space.
EACCES Write access to the directory containing pathname is not allowed for the process's effective uid, or one of the directories in path-
name did not allow search (execute) permission.
EPERM The directory containing pathname has the sticky-bit (S_ISVTX) set and the process's effective uid is neither the uid of the file to
be deleted nor that of the directory containing it.
ENAMETOOLONG
pathname was too long.
ENOENT A directory component in pathname does not exist or is a dangling symbolic link.
ENOTDIR
A component used as a directory in pathname is not, in fact, a directory.
ENOMEM Insufficient kernel memory was available.
EROFS pathname refers to a file on a read-only filesystem.
CONFORMING TO
ANSI C, SVID, AT&T, POSIX, X/OPEN, BSD 4.3
BUGS
Infelicities in the protocol underlying NFS can cause the unexpected disappearance of files which are still being used.
NOTE
Under libc4 and libc5, remove was an alias for unlink (and hence would not remove directories).
SEE ALSO
unlink(2), rename(2), open(2), rmdir(2), mknod(2), mkfifo(3), link(2), rm(1), unlink(8)
Linux 1994-07-13 REMOVE(3)