Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Shell

  1. #1
    New Coder
    Join Date
    Mar 2005
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Shell

    i dont know much about unix but i need to do this so...
    how would i run
    KILL processname
    in unix from a php script?
    like in windows you would create a .bat file with KILL processname or whatever then exec(); (although i cant get exec to work lol)

  2. #2
    Regular Coder
    Join Date
    May 2002
    Location
    Virginia, USA
    Posts
    621
    Thanks
    0
    Thanked 6 Times in 6 Posts
    PHP Code:
    <?php
    $procName 
    "ftpd";
    echo 
    exec('kill ' $procName);
    ?>
    -Celt

  3. #3
    New Coder
    Join Date
    Feb 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If your permissions won't allow exec(); , I believe
    PHP Code:
    system(); 
    will do the same thing.

  4. #4
    New Coder
    Join Date
    Mar 2005
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok thanks but,
    im making a control panel for shoutcast and their will be many sc_serv.exe processors running
    how would i get the process id for an individual process
    would it output the process id when i start sc_serv.exe?

  5. #5
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    Check out the man pages for ps.

    example:

    $> ps aux

    Will show you all the processes on the system.

    So look in the man pages for the right flag to get the pid, then pipe that to the command.


 

Posting Permissions

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