How to terminate while loop.
Hi
I started a while loop directly from terminal to read a file line by line and to run a command on each line. Post running the command I realized to modify the command and tried to stop the loop by using CTRL+C but it didn't stop. I closed that terminal directly but loop is still running. I also tried to KILL the process but it is getting started automatically with a new PID. Please suggest to stop this loop. Thanks. |
kill the parent process, probably a bash shell.
|
How did you start the while loop?
|
What I did is I searched the PID for the command running on each line and killed the same. Please suggest, how to kill parent process.
|
while read line
do ldapsearch $line done < filename |
pstree -p will show the parents with their PIDs
|
Use the pstree command to find the parent process, e.g.
Code:
pstree -p username Edit: Beaten by catkin for a bunch of seconds! ;) Hi Charles! :) |
Quote:
EDIT: and doesn't exit |
Quote:
|
Quote:
We keep doing that, one way round or the other |
Hi colucix
I killed the parent process but process is still running with a new parent ID. Also tried to move the filename. |
Try killing the parent's parent
|
Killing the parent process, didn't help.
|
Assuming you are not logged on as root, try killing the parent's parent and, if that doesn't work, the parent's parent's parent
|
Quote:
Quote:
If it is not a live system, then shutdown -h now or shutdown -g0 ` OK. |
All times are GMT -5. The time now is 09:03 AM. |