Find the answer to your Linux question:
Results 1 to 5 of 5
I just have a couple questions on how to accomplish what I'm trying to do, both in Bash and in Perl. I would like to know how to specify the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! computer_freak_8's Avatar
    Join Date
    Sep 2008
    Location
    Des Moines, Iowa, USA
    Posts
    55

    Questions about Bash/Perl signals/process names


    I just have a couple questions on how to accomplish what I'm trying to do, both in Bash and in Perl.

    1. I would like to know how to specify the process name (that would be used by killall) of the script.
    2. I would like to know what command I could put in the script to effectively "pause" it, and also what signal I would need to pass to the script to have it "resume" from the pausing command.

    I'm trying to accomplish both things with Bash and both things with Perl.

  2. #2
    Just Joined!
    Join Date
    Dec 2006
    Posts
    85
    well i dont know much about perl, but for for killall its pretty simple just killall <mane of process>
    for instance say im running a program called foo.bar i would say killall foo.bar
    if i wanted to send a certain signal (say SIGINT) i would use killall -s INT foo.bar

    killall can also kill a bunch of processes, so say i have foo.bar foo.this foo.that. and foo.theotherthing i can say kill foo, and kill all those foos.

    to stop one simply send it SIGSTOP and resume is SIGCONT

    hope that helps

  3. #3
    Just Joined! computer_freak_8's Avatar
    Join Date
    Sep 2008
    Location
    Des Moines, Iowa, USA
    Posts
    55
    Quote Originally Posted by the_ultimate_samurai View Post
    killall can also kill a bunch of processes, so say i have foo.bar foo.this foo.that. and foo.theotherthing i can say kill foo, and kill all those foos.

    to stop one simply send it SIGSTOP and resume is SIGCONT
    Okay, but is there a way to specify what process name a script will use when it is run? Also, is there a way for the script to SIGSTOP itself?

  4. #4
    Just Joined!
    Join Date
    Dec 2006
    Posts
    85
    the name of the process is the name of the application you ran.

    so suppose i compile a program foo.cpp into an executable foo.bar, i run foo.bar, now if i killall foo.bar..that executable is killed.

    if you made test.sh and ran it, you can kill it with killall test.sh
    and yes, it can stop itself (though...you coulda just made a shell like i did in a couple seconds and tested that yourself.)

  5. #5
    Just Joined! computer_freak_8's Avatar
    Join Date
    Sep 2008
    Location
    Des Moines, Iowa, USA
    Posts
    55
    Quote Originally Posted by the_ultimate_samurai View Post
    the name of the process is the name of the application you ran.

    so suppose i compile a program foo.cpp into an executable foo.bar, i run foo.bar, now if i killall foo.bar..that executable is killed.

    if you made test.sh and ran it, you can kill it with killall test.sh
    and yes, it can stop itself (though...you coulda just made a shell like i did in a couple seconds and tested that yourself.)
    Ah, I get it; thanks! So, I just name the script whatever I want to be used by killall, and then for script test.sh, I would add a line in it like "killall -s SIGSTOP test.sh", and then I can resume it from another script by "killall -s SIGCONT test.sh". I think I understand this now. Thanks!

Posting Permissions

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