Startup script help

James McDonald james
Tue Dec 28 05:51:12 PST 2004


Chong Yu Meng wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi All,
>
> I'm trying to write my first RedHat/Fedora-style startup script (no
> flames, please !) for IBM's Cloudscape database (now called Apache
> Derby). It works for the most part, but I need clarification on a few
> things. The script is appended at the end of this email.
>
> 1. I googled about and someone was saying that the script needed to
> follow a certain format at the beginning of the file, in order for
> chkconfig to recognize it as a valid startup script. The line that
> puzzles me is :
>
> # chkconfig: 345 95 05
>
> I understand that the first 3 numbers (345) refer to the run-levels, but
> what are the other numbers (95 05)? I copied this off someone else's
> script, so I'm not even sure if these numbers are appropriate to 
> Cloudscape!
>
This relates to when in the the service will be started and killed in 
relation to the other services i.e. if i had another service with

chkconfig 345 96 04

Then the service would start after the 95 and be killed before the 05

This allows you to tune the service to make sure services it depends on 
are started prior to it.

Look in the /etc/rc.d/rc*.d/ directory at the symlinks and you will see 
the script is symlinked as S95<scriptname> and K05<scriptname>

> 2. I am trying to suppress the response messages after the Cloudscape
> database is started up and/or shutdown, so I do "> /dev/null 2>&1". I've
> seen this is several scripts, and I thought this would work, but it does
> not -- the response messages are still displaying. I think I may have
> misunderstood the purpose of "> /dev/null 2>&1". Can someone tell me
> what this is supposed to do, and how I can properly suppress messages?

Would the & be causing it to fork into the back ground before it gets a 
chance to hit the >/dev/null 2>&1 ??? Just a thought.

> The script is shown below:
>
>
> #!/bin/bash
> #
> # Cloudscape startup script - Version 0.0.1
>
> # chkconfig: 345 95 05
>
> # description: Script for starting/stopping Cloudscape
>
> # processname : cloudscape
>
> # NOTES:
> #
> # This script is specifically for Fedora Core systems.
> #
>
> ######################################################
>
> # Source function library
> . /etc/rc.d/init.d/functions
>
> # See how we are called
> case "$1" in
>
> ~        start)
> ~                # Set CLOUDSCAPE_INSTALL
> ~                CLOUDSCAPE_INSTALL=/opt/ibm/Cloudscape_10.0
> ~                # Set CLASSPATH
> ~                [ -z "$CLASSPATH" ] && {
> ~                        .
> "$CLOUDSCAPE_INSTALL"/frameworks/NetworkServer/bin/setNetworkServerCP.ksh
> ~                }
> ~                # Start Cloudscape as network server on port 1368
> ~                action "Starting Cloudscape: " /bin/true
> ~                java org.apache.derby.drda.NetworkServerControl start -p
> 1368 & > /dev/null 2>&1
>
> ~                echo
> ~                ;;
> ~        stop)
> ~                # Set CLOUDSCAPE_INSTALL
> ~                CLOUDSCAPE_INSTALL=/opt/ibm/Cloudscape_10.0
> ~                # Set CLASSPATH
> ~                [ -z "$CLASSPATH" ] && {
> ~                        .
> "$CLOUDSCAPE_INSTALL"/frameworks/NetworkServer/bin/setNetworkServerCP.ksh
> ~                }
> ~                # Stop Cloudscape network server
> ~                action "Stopping Cloudscape: " /bin/true
> ~                java org.apache.derby.drda.NetworkServerControl shutdown
> - -p 1368 & > /dev/null 2>&1
>
> ~                echo
> ~                ;;
> ~        restart)
> ~                action "Restarting Cloudscape: " /bin/true
> ~                $0 stop
> ~                $0 start
>
> ~                echo
> ~                ;;
> ~        *)
> ~                echo "Usage: $0 {start|stop|restart}"
> ~                exit 1
> esac
>
>
> - --
> ~ --------------------------------------
> ~ Pascal Chong
>
> ~ Visit me at : http://cymulacrum.net
>
> ~ Anyone who uses the phrase "easy as taking candy from a baby" has never
> ~ tried taking candy from a baby.
> ~                -- Robin Hood
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFB0TAbmVdpiRJSldgRArefAKDShNws/fNlmeHg+okztbFeILGMKgCg0f9J
> c2SST7QfGfT9Aa5KZrQMBsY=
> =9cOR
> -----END PGP SIGNATURE-----
> _______________________________________________
> Linux-users mailing list
> Linux-users at linux-sxs.org
> http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
>
> Need to chat further on this subject? Check out #linux-users on 
> irc.linux-sxs.org !




More information about the Linux-users mailing list