Find the answer to your Linux question:
Results 1 to 5 of 5
Dear all in the following pseudo shell script how can I kill run_crafty ? Code: for(( i = 0 ; i < 500 ; i++ )) do run_crafty done Is ...
  1. #1
    ARH
    ARH is offline
    Just Joined!
    Join Date
    Apr 2009
    Posts
    11

    Kill processes called by a shell script

    Dear all

    in the following pseudo shell script how can I kill run_crafty ?
    Code:
    for(( i = 0 ; i < 500 ; i++ ))
    	do 
    	run_crafty
    	done
    Is there any other way to call run_crafty in a loop which I can kill the whole loop simpler ?

  2. #2
    ARH
    ARH is offline
    Just Joined!
    Join Date
    Apr 2009
    Posts
    11
    also I tried

    for(( i = 0 ; i < 500 ; i++ ))
    do
    killall run_crafty
    done

    but it didn't work and it only kill one run_crafty process and the second process run when all killall command finish.

  3. #3
    Just Joined!
    Join Date
    May 2009
    Posts
    17
    A very Crooked method is:

    while true
    do
    killall run_crafty
    done

  4. #4
    Just Joined!
    Join Date
    May 2009
    Posts
    17
    Do let me know whether the above one worked or not????

  5. #5
    Linux User
    Join Date
    May 2008
    Location
    NYC, moved from KS & MO
    Posts
    251
    Have you tried to terminate the for loop (with Ctrl + C) first, then issue the following command?
    Code:
    killall crafty
    I believe you need to stop for loop from forking new processes before you can terminate all the running crafty processes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...