Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

S10Jobs runs fine, but K10Job fails. Why?

Status
Not open for further replies.

Sina

Technical User
Jan 2, 2001
309
0
0
CA
I have 2 scripts that starts and stops a job.

Startscript

#!/bin/csh
su - oracle -c "/jobs/db101start"


my stopscript is

#!/bin/csh
su - oracle -c "/jobs/db102stop"

Now I have created 2 scripts called them startdb101 and stopdb102 and place them in ../init.d

Created sym link for both files with the names of
S10db101start and K10db102stop under .../rc3.d

rebooted the server.

during the reboot, my job starts very nicely and things work fine but when I shutdown, my shutdown job does not run.

Also Not very familar with chkconfig.

thanks much for your input.


 
S means that the program will be run with 'start' and K with 'stop' argument, when you enter given runlevel. You have to place your K link to different directory, probably rc0.d, rc1.d and rc6.d.
 
I think the script could be the problem

Here it is
#!/bin/sh
#
# dB start/stop To start & Stop Database
#
# chkconfig: 2345 99 10
# description: Database Start/Stop Script
##########################

# Source function library.

case "$1" in
start)
echo -n "Starting Oracle Database Server: "
su - oracle -c "/db1/dbstart"
echo -n "Starting Oracle Listener: "
su - oracle -c "/db1/lsnrctl start"
echo
;;

stop)
echo -n "Shutting down Oracle:"
su - oracle -c "/db1/lsnrctl stop"
su - oracle -c "/db1/dbshut"
echo
;;

status)
status Oracle
;;

restart)
$0 stop
$0 start
;;

*)
echo "Usage: oracleDbServer {start|stop|restart|status}"
exit 1

esac
exit 0

And I do have the K99jobs in rc6.d

Any idea?

start job works fine but not the shuting down of the db part



 
Here is something to get you going

You should have a good look at some other scripts on the net.

This script is suitable for Mandrake Linux, but can easely be changed for another Distro (have a look at other scripts in your init.d directory for some pointers).

Please change {whatever} into something appropiate :)
(And ofcourse the other things between the curly braces {} )

Code:
#!/bin/sh
#
# Startup script for {Whatever}
#
# description: {description)
# processname: {processname}

# Source function library.
. /etc/rc.d/init.d/functions

# Just the options
OPTIONS=""

# See how we were called.
case "$1" in
  start)
        gprintf "Starting {whatever}: "
        if [ -f /var/lock/subsys/{whatever}] ; then
                echo
                exit 1
        fi

        daemon {commandline} $OPTIONS 2>&1 &
        echo
        touch /var/lock/subsys/{whatever}
        ;;
  stop)
        gprintf "Shutting down {whatever}: "
        killproc {whatever}
        echo
        rm -f /var/lock/subsys/{whatever}
        ;;
  status)
        status {whatever}
        ;;
  reload|restart)
        $0 stop
        $0 start
        ;;
  *)
        gprintf "Usage: %s {start|stop|restart|reload|status}\n" "$0"
        exit 1
esac

exit 0

Hope it helps :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top