Options

get process id of application server

mrQQmrQQ Member Posts: 239
greetings,

i have a situation where i need to be able to close NAS from code, considering that there might be other NAS running. they are started from command line (not from services). so i thought i could get current process id, and then kill it. but how?

any ideas?

thanks!

Comments

  • Options
    DenSterDenSter Member Posts: 8,304
    I think you can do "net stop <NAS name>", but I have not tried this myself.
  • Options
    DoomhammerDoomhammer Member Posts: 211
    denster: i think U cannot use NET STOP for something, what is not started as service.
    Martin Bokůvka, AxiomProvis
  • Options
    DenSterDenSter Member Posts: 8,304
    Well since NAS is usually installed as a service, that would work just fine wouldn't it :).
  • Options
    mrQQmrQQ Member Posts: 239
    yes, but i specifically told it's not being run from services.
  • Options
    DenSterDenSter Member Posts: 8,304
    ah you're right, I missed that *digging the sand out of my eyes* :oops:
  • Options
    mrQQmrQQ Member Posts: 239
    lol :) so anyway, so far i've got this - i found this command line app which prints parent pids to stdout.. i can pipe that to file, if i use comspec to run it.. i can get comspec with ENVIR, but Navision wont let run apps via variable, only text :( and then i would need some way to actually kill that pid (though that could be done with app aswell)
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    mrQQ wrote:
    [...]but Navision wont let run apps via variable, only text :( and then i would need some way to actually kill that pid (though that could be done with app aswell)

    You can use the method described in this thread (using 'Windows Script Host Object Model'.WshShell) to execute an app without security warning: http://www.mibuso.com/forum/viewtopic.php?t=7446
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    DenSterDenSter Member Posts: 8,304
    You know, you could MAKE it a service, and use Alain's example in the how-to section to control it. You shouldn't be starting anything from the command prompt in a production environment anyway.
  • Options
    mrQQmrQQ Member Posts: 239
    no, in this case, i can't make it a service..
  • Options
    krikikriki Member, Moderator Posts: 9,090
    DenSter wrote:
    You know, you could MAKE it a service, and use Alain's example in the how-to section to control it. You shouldn't be starting anything from the command prompt in a production environment anyway.
    Actually, my example is for DB-services, but in fact, the idea can also be used for NAS-services.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.