Link to home
Start Free TrialLog in
Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on

Stopping flocksnippet: Killed (core dumped) on doing kill -9

Hi,
I am getting the following output of running a command on linux :
[robinsu@olympus101 ~]$ sudo service snippet stop

Stopping flocksnippet: Killed (core dumped)

                                                           [FAILED]

Open in new window


Although my application does stop but i want to understand why this [FAILED] is coming. Is this something to be handled ?

Here is my init script used to stop and start the application:

#!/bin/bash
# chkconfig: 3 99 99
# description: code snippet app
# processname: snippet

prog="flocksnippet"
user="flocksnippet"
snippet="/opt/flock-snippets"

. /etc/init.d/functions
lockfile=/var/lock/subsys/$prog

start() {
    PATH="$PATH:/bin"
    FLOCK_APPS_CONFIG=$(cat /etc/env)
    exec="/usr/java/default/bin/java -DFLOCK_APPS_CONFIG=${FLOCK_APPS_CONFIG} -jar snippet.jar"
    cd $snippet
    daemon --user=$user $exec &
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    PATH="$PATH:/bin"
    echo -n $"Stopping $prog: "
    exec="pgrep -u flocksnippet | xargs kill -9"
    daemon --user=$user $exec
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart()
{
    stop
    start
}

case "$1" in
    start)
        $1
        ;;
    stop)
        $1
        ;;
    restart)
        $1
        ;;
    *)
       exit 2
esac
exit $?

Open in new window


Thanks
ASKER CERTIFIED SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rohit Bajaj

ASKER

Hi,
Its not getting reproduced if i do kill -9 <pid>
I tried  exec="pgrep -u flocksnippet | xargs kill"
But still getting :
sudo service snippet stop
Stopping flocksnippet: Terminated (core dumped)
                                                           [FAILED]

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I created the init script...
The daemon function which i am using is inside /etc/init.d/functions
There are no other process for the user flocksnippet.
My initscript is only createing process for this particular user

functions file you can look at :
http://bash.cyberciti.biz/guide//etc/init.d/functions
Its same as i have on my linux machine
I can remove the -9 .. But since still this error happens i guess there must be something wrong with the way i am killing using daemon