Unix pkill error; does wily obstruct me killing the process?


 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications Unix pkill error; does wily obstruct me killing the process?
# 1  
Old 10-31-2011
Unix pkill error; does wily obstruct me killing the process?

have two scripts on Unix; one that starts some processes and the other one for killing a process. At first, I ran the .sh without WILY in it and it worked perfectly; in this way, I could also ran my stopper process. However I need WILY in this so I added it to my script but this time, a message about WILY shows up instead of the first version which is perfectly normal but when I try to run my stop process it doesn't work anymore; it probably couldn't find the process with the name given. Here are my scripts:

start_scpc.sh

Code:
export CLASSPATH='.:'
    export CLASSPATH=$CLASSPATH'./resources'

    cd lib
    for file in *.jar; do export CLASSPATH=$CLASSPATH':./lib/'$file; done
    cd ..


    # --- define WILY java options here :: Must be declared at the beginning
    ## ------------------------------------------------------------------------------
    WILY_HOME="/export/home/scpcstb/wily823"
    WILY_OPTIONS="-javaagent:${WILY_HOME}/Agent.jar -Dcom.wily.introscope.agentProfile=${WILY_HOME}/IntroscopeAgent.profile -Dcom.wily.introscope.agent.agentName=SCPC_STB"
    ## ------------------------------------------------------------------------------


    APPLICATION_NAME=SCPC_STB
    MAIN='tr.com.turkcellteknoloji.scpc.core.Main'
    JAVA_PARAM="-Xmx1g -Xbatch  -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=5563 -Dcom.sun.management.jmxremote.authenticate=false  -Dcom.sun.management.jmxremote.ssl=false"

    echo "JVM"
    echo "CHECKING $APPLICATION_NAME PROCESS"

    if [ 0 == `pgrep -fl application=$APPLICATION_NAME | wc -l` ]
    then
      echo "....................STARTING $APPLICATION_NAME........................"
      echo "Please wait"
      echo "See log files for details"

    /usr/jdks/scpcstb/bin/java -server ${WILY_OPTIONS} -Dapplication=$APPLICATION_NAME $JAVA_PARAM -cp $CLASSPATH $MAIN >> ./logs/scpcConsole.log 2>&1  &


    sleep 1    
    until [ 0 != `pgrep -fl application=$APPLICATION_NAME | wc -l` ]; do
    sleep 1
    done

    echo "....................$APPLICATION_NAME STARTED........................."

    else
    echo "$APPLICATION_NAME IS ALREADY RUNING!!!"
    fi

    exit 1

and my stop_scpc.sh:

Code:
pkill -f application=SCPC_STB

This pkill doesn't work anymore... Any help with this would be highly appreciated, thanks.
# 2  
Old 11-12-2011
It's possible your pkill command is finding and killing the pgrep command that has the identical string. Also, if the java application reads from stdin, it's possible it needs to be sent the HUP signal. In that case, you should send the HUP signal. Try..
Code:
pkill -1 -o -f application=SCPC_STB

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Process with S state(Interruptable) in RHEL and gives Advertise error after restarting/Killing the p

Hello, In our Production system one process is in S state(interruptible)and after killing and restarting the process gives 'advertise error'. This error goes after rebooting the Server. I have RHEL 5.9 (tikanga) OS in our server. We tried debugging the issue with the help of 'strace' command... (9 Replies)
Discussion started by: Rohits
9 Replies

2. Homework & Coursework Questions

Unix Script -- To Skip killing a specific process

Hi, By using ps -aux | awk '/mine/{split($15,a,"/");print $1,$2,a}' i get the below listed PID's with there corresponding processes. adm 1522 ABC_Process.tra adm 1939 GENE_Process.tra adm 2729 GENE_Archive.tra adm 3259 xyz_Process.tra I use ps -aux | awk... (5 Replies)
Discussion started by: murali1687
5 Replies

3. Shell Programming and Scripting

Finding the age of a unix process, killing old processes, killing zombie processes

I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time. Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Discussion started by: sukerman
0 Replies

4. Shell Programming and Scripting

Killing a process within 5 min it starts in Unix using perl

Hi All, I have to kill a program whose pid, i will be getting. Multiple processes will be getting started by my script of same kind in a series. So for after each call to a process i need to write a command or script which can kill the process if it takes more than 5min. In this i will... (3 Replies)
Discussion started by: nishank.jain
3 Replies

5. UNIX for Dummies Questions & Answers

kill/pkill process by CMD info.

I have a process that I'd like to kill. Doing a "ps -fu myusername" gives me: UID PID PPID C STIME TTY TIME CMD myusername 5443 1 0 10:05 ? 00:00:00 /bin/sh /some/path/crap.sh -s /yet/another/path/parentProcess myusername 5593 5443 0 ... (2 Replies)
Discussion started by: mrwatkin
2 Replies

6. UNIX for Dummies Questions & Answers

killing the process

Hi, First, I am running a scipt.While the script is running I realize that I dont want the script to be run so I am killing the script externally.Before the process gets terminated or killed it should delete all the temporary files created by the script.How to do this?Can anyone help me? ... (3 Replies)
Discussion started by: arthi
3 Replies

7. Shell Programming and Scripting

Killing of a process and send a mail if the process doesnot come up within 2 minutes

Hi Friends, I am new to this forum as well as new to shell scripting. I have a problem here and i need someone to solve this. Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the argument . There is a... (1 Reply)
Discussion started by: Prince89
1 Replies

8. UNIX for Dummies Questions & Answers

killing a process

I can kill running processes on my linux red hat system using ctrl-c but cannot do it from command line of another terminal using kill -2 pid. Although I can kill them from command line using kill -9 pid and other signals. I would like to do it using the kill -2 pid. Thanks for your suggestions (6 Replies)
Discussion started by: bbhayana
6 Replies

9. Solaris

killing a unix job after the job process gets completed

Hi, Thanks in advance. i need to kill a unix background running job after that job process completes. i can kill a job by giving the following unix command kill -9 processid how to kill the job after the current process run gets completed ? Appreciate your valuable help. Thanks... (7 Replies)
Discussion started by: dtazv
7 Replies

10. Shell Programming and Scripting

killing unix job after the job process completes

Hi, Thanks in advance. i need to kill a unix background running job after that job process completes. i can kill a job by giving the following unix command kill -9 processid how to kill the job after the current process run gets completed ? Appreciate your valuable help. ... (1 Reply)
Discussion started by: dtazv
1 Replies
Login or Register to Ask a Question