06-28-2002
finding out the pid for a busy text file
Can some one please tell me how to find out the proccess ID that is holding up a file.
I am attempting to remove a file and I am getting a message stating that it is busy.
i.e
rm filename
filename: 777 mode ? (y/n) y
rm: filename not removed. Text file busy
Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a script that when run creates 4 other text files. Sometimes a couple of these text files are empty. So what I am trying to do is find out if there is text in the file and if not delete the file.
What I have so far is the following script. I am just not sure how to return a true value... (9 Replies)
Discussion started by: iCONAN
9 Replies
2. UNIX for Dummies Questions & Answers
How do i find text string in a file if i have no idea where the file is?
What I am trying to do is find an email address in a file and have no idea where the file is.
Thanks (5 Replies)
Discussion started by: §ynic
5 Replies
3. Shell Programming and Scripting
Hi, is there a command that takes the PID of a process and that only diplays it's ni number?
I`m pretty sure it would require pipes but I tried a few things that ended up miserably...
Since the ps command doesn't show the ni unless I do ps -o ni but then I can't find a way to search the right... (2 Replies)
Discussion started by: Yakuzan
2 Replies
4. Shell Programming and Scripting
Hi All,
Am copying mulitple files in a directory in names File0,File1,File2 etc.
I need to print separately the PID of these copies using File names.
for((i=0;i<5;i++))
do
mypid=`ps aux | awk '/File$i/ && !/awk/ { print $2 }'`
echo PID is $mypid
done
It printed nothing. Thinking... (6 Replies)
Discussion started by: amio
6 Replies
5. UNIX for Advanced & Expert Users
Hi,
We have a filesystem mystery on our hands. Given:
2 machines, A and Aa.
Machine Aa is the problem machine.
Machine A is running Ubuntu, kernel 2.6.22.9 #1 SMP Wed Feb 20 08:46:16 CST 2008 x86_64 GNU/Linux. Machine Aa is running RHEL5.3, kernel 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38... (2 Replies)
Discussion started by: mschwage
2 Replies
6. Solaris
Say I have 2 processes(perl scripts on Solaris machine) A and B.
the process A kill the process B.
While in the process B how do I print the PID of the process that Killed it(process A) before dieing.
My process A looks like
open(STATS, "ps -ef|");
while ($inputLine = <STATS>) {
if... (7 Replies)
Discussion started by: enigma_007
7 Replies
7. Solaris
Hi Experts,
I was asked to find most busy file system on one of the server. It is Sun 10. Any idea to get this?
Thanks,
Deepak (5 Replies)
Discussion started by: naw_deepak
5 Replies
8. Shell Programming and Scripting
Hello,
Please help me with this.
I have two files. file1.txt and file2.txt
File1 contains text as below
txt1 txt2
txt3 txt4
txt5 txt6
txt7 txt8
File2 contains text as below
$1 $2 $3 $4 $5 $6 $7 $8 $9
-----------------------------
txt1 txt2 - - - 0 2 8 -*-
txt0 txt7 - - - 1 4 8... (3 Replies)
Discussion started by: tenderfoot
3 Replies
9. Shell Programming and Scripting
Hello All,
I am facing difficulty in getting the PID value & then assigning it to a variable,
kindly help me in resolving the issue.
Thanks a lot in advance.
The custom utility used inside the Test2.sh will process the file in a batch of 10 lines at once and for efficient memory management,... (3 Replies)
Discussion started by: duddukuri
3 Replies
10. Shell Programming and Scripting
Hello All,
I need to run a set of scripts, say 50 of them, parallely. I'm running these 50 scripts, from inside a script with the help of 'nohup' command.
1.The fifty scripts are stored in a separate file.
2.In a master script, i'm reading every line of the file through loop and executing... (4 Replies)
Discussion started by: SriRamKrish
4 Replies
LEARN ABOUT DEBIAN
af_establish
af_files(3) Attribute Filesystem (AtFS) af_files(3)
NAME
af_crkey, af_open, af_close, af_rm, af_establish, af_restore - AtFS file system operations
SYNOPSIS
#include <stdio.h>
#include <atfs.h>
int af_crkey (char *syspath, char *name, char *type, Af_key *aso)
FILE *af_open (Af_key *aso, char *mode)
int af_close (FILE *stream)
int af_rm (Af_key *aso)
int af_establish (Af_key *aso, char *filename)
int af_restore (Af_key *aso, Af_key *restoredAso)
DESCRIPTION
af_crkey creates an object key for a regular UNIX file identified by name, type and system path. syspath is an either absolute or relative
directory name. An empty syspath refers to the current directory. By convention, AtFS interprets the filename suffix of a UNIX file as type
and the filename without suffix as name attribute. To give an example, the path name
/usr/andy/foo.c is split up in /usr/andy (syspath) foo (name) c (type)
A period as first character in the filename is always considered as part of the name. Hence .cshrc has a name but no type. "." and ".." are
recognized as names too. If the named UNIX file does not exist, af_crkey creates an empty file. The created key remains accessible until
it is explicitly given up by af_dropkey (manual page af_retrieve(3)).
af_open opens the contents of the ASO pointed to by aso and associates a stream with it. A pointer to the FILE structure associated with
the stream is returned. Mode is a character string that is either "r[+]", "w[+]" or "a[+]". See fopen(3) for further details. Upon error,
af_open returns a NULL pointer. Non-busy ASOs can only be opened with mode "r". If a non-busy ASO is opened, it's contents will be placed
in a temporary UNIX file due to storage of versions as deltas.
af_close closes a stream previously opened by af_open (see fclose(3)). Temporary files created by af_open, holding the contents of a saved
versions are unlinked right after being opened so that they will automatically disappear on closing.
af_rm removes the specified ASO. The application has to have a lock (see af_lock(3)) set on the ASO that shall be deleted by af_rm. ASOs
with the state attribute set to accessed or frozen cannot be removed. If you keep multiple keys of one object (perhaps in different sets)
af_rm invalidates all keys of the removed object. As AtFS does not support multiple links to saved ASOs, af_rm on a saved version always
does a physical removal.
af_establish establishes the contents of the saved version, pointed to by aso in a file named filename. The resulting file gets the ver-
sion's modification and access date.
af_restore is used to restore formerly saved derived ASOs into their old file location. It also restores the file modification and access
date. This function cannot be applied to source objects. af_restore returns the key of the restored version in the buffer restoredAso.
SEE ALSO
fopen(3), fclose(3), af_retrieve(3), af_lock(3)
DIAGNOSTICS
Upon error, -1 or a nil pointer (depending on the return type) is returned and af_errno is set to the corresponding error number.
AtFS-1.71 Fri Jun 25 14:33:07 1993 af_files(3)