Find the answer to your Linux question:
Results 1 to 3 of 3
Is it possible? I think everything is possible in linux.. kinda first problem is... Is it possible to delete/kill a screen just by typing its name? the name i used ...
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    Posts
    2

    Assigning PID and other problems

    Is it possible? I think everything is possible in linux.. kinda

    first problem is... Is it possible to delete/kill a screen just by typing its name? the name i used to create the screen for example screen -S ircSrv

    if not is it possible to pre-assign a pid to it? and if yes how

    second is it possible to assign a pid to any application?

    the reason i am asking these questions is because i am building a php tool to control several applications that have multiple instances, controls such as start, restart.. When it comes to the php part i have everything working.. the problem is on finding the correct PID to kill...

  2. #2
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,096

    Red face

    Afaik, it is not possible to assign a pid.

    The usual way of solving a problem like this is to create a pid-file upon startup by an init script.
    The init script would then use that pid-file to kill the process for the stop procedure.

    Add some sanity logic..
    - the process with the pid of the pid-file must also match the name of your process
    - pid-file is there, but no process? Delete pid-file and tell the user about it
    - process is there, but no pid-file? Do nothing, just warn the user about it.
    ..and your problem is solved.

    You can grep through the init scripts on your system to get examples.
    Php is your language of choice, so you will have to adapt a bit.
    But this is surely manageable
    Last edited by Irithori; 01-08-2010 at 06:24 PM.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Jan 2010
    Posts
    2
    thanks for the help!

    i have figured something else though.. i am gonna create in php a script that will rename the process name and then ps ux | grep application_name

    so i can easily retrieve pids by the name of the application with out messing with the other instances


    and yeah with the PHP libssh2 package everything is possible.. SSH-wise, php has so flexible implantation

Posting Permissions

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