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
Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gerwin Jansen, EE MVETopic Advisor Commented:
You are killing the application instead of stopping it. The -9 signal you send it will trigger the application core dump as well as the text you're seeing. Try to reproduce by starting your application using the service start command and then killing that java command line (once running) using "kill -9 <pid>" where pid is the process id of that java command line.

If you want to stop the process you could leave out the -9 in the 'stop' command, like this:

exec="pgrep -u flocksnippet | xargs kill"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rohit BajajAuthor Commented:
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

Gerwin Jansen, EE MVETopic Advisor Commented:
I see you're using daemon to start your process but you're killing all processes of user flocksnippet (pgrep -u) - I don't think this is the right way to stop your daemon process. I would just kill that java process (without the -9 still). How did you create / get your init script exactly?
Rohit BajajAuthor Commented:
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
Rohit BajajAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.