killing nohup commands delete files?


 
Thread Tools Search this Thread
Special Forums Hardware Filesystems, Disks and Memory killing nohup commands delete files?
# 1  
Old 07-06-2007
killing nohup commands delete files?

Hello,

I just want to ask if killing a specific procees might delete files being read of that process?

Here is the scenario: I execute nohup find . -type f |xargs ls -lrt > nohup1.out &

I noticed that it is taking so much space, I check that there are files so huge
.nfs* and keep on growing, I use fuser command to check what processes using that file and kill them all. The free space increases. I'm suspecting that it also checked other mountpoints so it runs forever.

I am not sure that killing those processes and removing those .nfs* has the possibility that it also delete files as well as directories. The command is just ls -lrt. Let me know if that is a possiblity.
# 2  
Old 07-11-2007
Quote:
Originally Posted by james_falco
I just want to ask if killing a specific procees might delete files being read of that process?
No, however a program may create temporary files which it may then clean up on exit.

All that the operating system does with a killed process is to close it's open files.
# 3  
Old 07-11-2007
But closing a file may indeed delete it. We get this question quite a bit. Someone will do something like:
yes > really.big.file &
and observe that really.big.file has consumed all of the disk space in a filesystems. They then do "rm really.big.file" and post a question wondering why the space was not freed. The rm command simply removes the lasy hard link to the file. But the file is still open so the space will not be freed. The space will be freed when the last process that has it open finally closes it.

A more complex situation arises when two processes on a single NFS client open a file on a NFS server. Should one of the processes wish to delete the file, the client code will detect that a second process has it open. To perserve the integrity of the filehandle the client will rename the file to a hidden name and with most implementations, .nfsnnnnn is the name that is used. When the last process on the NFS client closes the file, the NFS client code will indeed delete the .nfsnnnnn file. This is not a super robust solution and it screws up if multiple processes have the file opened on different NFS clients, and this will usually result in stale filehandles. But I'm just the messenger.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Execute Oracle pl/sql commands in a scrit using nohup

Good afternoon: I need your help please, Im new at Unix nd specially Unix applicationas like oracle and Ive got this problem: I was asked to execute the next script using nohup in order to not hang up the session because it was supposed to connect to the database and then insert about 2... (3 Replies)
Discussion started by: alexcol
3 Replies

2. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

3. Shell Programming and Scripting

Find files and execute commands on these files (advanced)

So, I need to find a bunch of files and delete them (this example, but sometimes I need it for something else) and my trusty go-to command has always been: find . -type f -name '*file*' | xargs -I## rm '##' Works wonders... But: touch file\ file\'.txt touch file.txt touch file\ file.txt... (6 Replies)
Discussion started by: Mr.Glaurung
6 Replies

4. Shell Programming and Scripting

Saving nohup output to a file other than nohup.out

Shell : bash OS : Oracle Linux 6.4 I want to save the ouput of a nohup command to file other than nohup.out . Below are my 3 attempts. For both Attempt1 and Attempt2 , the redirection logs the output correctly to the output file. But I get the error "ignoring input and redirecting stderr to... (7 Replies)
Discussion started by: kraljic
7 Replies

5. UNIX for Dummies Questions & Answers

How to use 'nohup' and 'at' commands collectively?

I have a unix script named 'test1' and it can be run using parameters say a, b and c. i.e. the command would be test1 -a -b -c this script gives the output in the log file as script started start time: 10.22 pm 7 april end time: 10.30 pm 7 april script finished Now, i want to run... (3 Replies)
Discussion started by: swap21783
3 Replies

6. Shell Programming and Scripting

Finding the age of a unix process, killing old processes, killing zombie processes

I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time. Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Discussion started by: sukerman
0 Replies

7. Shell Programming and Scripting

Unix commands delete all files starting with "X" except "X" itself. HELP!!!!?

im a new student in programming and im stuck on this question so please please HELP ME. thanks. the question is this: enter a command to delete all files that have filenames starting with labtest, except labtest itself (delete all files startign with 'labtest' followed by one or more... (2 Replies)
Discussion started by: soccerball
2 Replies

8. Shell Programming and Scripting

using nohup with set of commands

hi I want to use nohup command with set of commands .. my goofy sample : nohup while true do ; date; done and its not working . any idea ? cheers (1 Reply)
Discussion started by: kvok
1 Replies

9. Shell Programming and Scripting

using mutiple "nohup" to execute multiple commands.

I need to run multiple commands on remote server using the nohup... I have tried 2 options 1) rsh <SERVER_NAME> -n "nohup perl $SCRIPTS_DIR/abc.pl ; $SCRIPTS_DIR/xyz.ksh & " & 2) rsh <SERVER_NAME> -n "nohup perl $SCRIPTS_DIR/abc.pl & nohup $SCRIPTS_DIR/xyz.ksh & " & I need to know if... (2 Replies)
Discussion started by: aster007
2 Replies

10. UNIX for Dummies Questions & Answers

"nohup" and "&" commands

Why would anyone ever type in a command like this: nohup command & nohup lets you logout of your telnet session so why add "&" to run it in the background? (1 Reply)
Discussion started by: xadamz23
1 Replies
Login or Register to Ask a Question