Find the answer to your Linux question:
Results 1 to 2 of 2
2 java process running on pc, i need to kill those java processes and after kill all java process i need to start it, this script should run as cronjob. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2012
    Posts
    10

    write script for kill process


    2 java process running on pc, i need to kill those java processes and after kill all java process i need to start it, this script should run as cronjob.

    as a function, i used

    i take java count from this
    jvcount=$(ps -e|grep java |wc -l)

    if it is equal to 2
    then need to kill java node 1 like following
    kill -term `/sbin/pidof java_n1`
    then, if java count qual to 1 then need to kill java node 2 as following
    kill -term `/sbin/pidof java_n2`

    then java count is equal to 0 need to start them again,

    that part i can do, if you guys can help pleas let me know how to do it.

  2. #2
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    hello, lahirushanaka

    you'll probably get better exposure for this help request if you use the report button (lower-left corner of your post) to ask one of the mods to move it to the programming/scripting forum


    edit: okay, it looks like one of them has moved it for you!
    Last edited by oz; 12-13-2012 at 04:51 PM.
    oz

Posting Permissions

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