Find the answer to your Linux question:
Results 1 to 3 of 3
I want to write a shell script which start tcpdump and firefox, and then it get blocked there until a signal comes like Code: for () do tcpdump & firefox ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2012
    Posts
    85

    block and unblock shell script


    I want to write a shell script which start tcpdump and firefox, and then it get blocked there until a signal comes

    like

    Code:
    for ()
    do
    tcpdump &
    firefox &
    
    blocked here
    
    wait for signal or anything else
    
    unblock
    
    kill firefox and tcp process
    
    do some other things
    
    done
    besides, actually the shell script is wating for a php script finishes some work, is there any good idea for the php script to signal the shell script ?

  2. #2
    Linux Newbie
    Join Date
    Nov 2012
    Posts
    224
    hi,

    use fifo

    your shell script reads the fifo (which "blocks" the shell script)
    your php script, before ending, writes into the fifo (which "frees" the shell script, that, then, executes next commands(kill tcpdump and firefox))

  3. #3
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by esolve View Post
    I want to write a shell script which start tcpdump and firefox, and then it get blocked there until a signal comes
    What do you mean by blocked exactly?

    besides, actually the shell script is wating for a php script finishes some work, is there any good idea for the php script to signal the shell script ?
    Did you not try the suggestion I made in your previous thread here? Using the Bash trap function and the kill command to send signals will easily do this.

Posting Permissions

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