Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1011763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:17:03+00:00 2026-05-16T09:17:03+00:00

I wrote init.d script that suppose to run java CLI proccess. The problem is

  • 0

I wrote init.d script that suppose to run java CLI proccess.
The problem is that when i stop it, i get [failed] and the proccess is still running.
thanks

#!/usr/bin/env bash
#
# chkconfig:    345 97 03
#
# processname:  quotes-srv
#
#
# source function library

. /etc/rc.d/init.d/functions

NAME=quotes-srv

start() {
    echo -n $"Starting $NAME: "
    daemon +19 java -Dlog4j.configuration="file:/opt/quotes/properties/log4j/log4j.properties"  -Dproperties_folder="/opt/quotes/properties/app/" -jar /opt/quotes/trade-0.0.1-SNAPSHOT-jar-with-dependencies.jar & 
touch /var/lock/subsys/$NAME
}

stop() {
    echo -n $"Stopping $NAME: "
    killproc $NAME
    echo
    rm -f /var/lock/subsys/$NAME
}

restart() {
    stop
    start
}

case "$1" in
  start)
    start
    ;;
  stop) 
    stop
    ;;
  restart|force-reload|reload)
    restart
    ;;
  condrestart|try-restart)
    [ -f /var/lock/subsys/$NAME ] && restart
    ;;
  status)
    status $NAME

    ;;
  *)
    echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
    exit 1
esac

exit 0
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T09:17:04+00:00Added an answer on May 16, 2026 at 9:17 am

    killproc will terminate programs in the process list which match the name $NAME

    Strictly speaking this is in your case java .

    If it is the only java process you can go and put java in $NAME

    If you run other java services you have to find another way to stop your java process, e.g. putting the PID in the /var/lock/subsys/$NAME file and then killing the process using the pid.

    On at least debian there is a nice tool which helps with this, but I am not sure it exists for
    redhat.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote an init script to execute last that will start some pythjon script.
I wrote a PHP script that allows me to get the dimensions (width and
I while back I wrote a shell script that automatically runs a python script
I wrote a script that collects all our log files to one tar file.
I wrote a script that decodes aydio using FFmpeg. Here's the code: JNIEXPORT jint
I have a fabric script that attempts to run the tests for an application
I wrote a simple Greasemonkey script that enlarges thumbnail pictures in a flyover popup.
I just started with python and wrote myself a nice, small script that uses
I have a script that I mean to be run from cron that ensures
I need to run a script that sets cpu_freq .In order to retain the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.