Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

One of our developers has a service that needs to be started on boot. This script needs to be fired:


Here is the startup script I'm working with, called /etc/init.d/bt:

# Provides:          BTServer
# Required-Start:    $local_fs $network $remote_fs
# Required-Stop:     $local_fs $network $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: BT Server
# Description:       BT Server
# Run BT startup scripts as btu user
# Location of startup script

test -x $BT_SCR || exit 5

# Set up rc_status command
. /etc/rc.status

case "$1" in
        echo -n "Starting BT Server"
        startproc -u btu $BT_SCR
        rc_status -v
        echo "Usage: $0 { start }"
        exit 1

exit 0

When I run /etc/init.d/bt start from the command line, the rc_status is failed every time, even though the script starts up fine. I don't quite understand how rc_status is determined; is it my responsibility to set the rc_status value?

I know I'll need to add a symlink to /etc/rc.d/rc3.d, but for now I'm trying to get it working from the command line as root.

share|improve this question
Did you have a look at other startup scripts under /etc/init.d/? – rozcietrzewiacz Nov 16 '11 at 10:20
up vote 2 down vote accepted

You should not use startproc for starting a shell-wrapper-script: startproc is meant to start a daemon-process directly. It checks if the process is up and running and sets its return-code accordingly.

In your case startup.sh won`t be running after Tomcat startup - there will be a java-process with a bag of parameters instead. So since "startup.sh" is not running any more, startproc will return "failure".

share|improve this answer
You know, I "felt" like using startproc was probably not appropriate here, but didn't listen to my instincts :). My head has been swimming with info after reading tons of docs, but have not seen clear answers. Thanks. – Banjer Nov 17 '11 at 15:43

I found this here on StackOverflow. They say there that

rc_status ... sets the "status value", which is the return value returned by rc_exit (which you place at the end of your init.d script)

share|improve this answer

You could take a look how I handled it in my RPM packages in devops-incubator :


share|improve this answer
If itsn't too long, please inline here. Or direct OP to e.g. the Fedora packaging guidelines. – vonbrand Feb 4 '13 at 11:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.