This article provides an example of auto startup and shutdown scripts to manage Dbvisit Standby v8 components - dbvnet, dbvagent, and dbvserver during a server reboot when systemd is NOT available.
Problem Details
Problem Statement
How to auto start/stop Dbvisit Standby v8 components on RHEL6 using /etc/init.d
Applicable Error Code
N/A
Affected Versions
Standby v8
Affected Platforms
RHEL 6 and below
Solution
The solution is quite similar and sample scripts are patterned to what we have for version 7, the key for v8 scripts is to make sure to set v8-specific values to the relevant variables. For instance, DBVISIT_BASE directory, dbvnet executable and the like.
Steps Performed
- An example startup script below can be placed in /etc/init.d/ directory. This should be owned by root user with execute permission.
- You can modify the "chkconfig: 345 95 5" line if required and then add the startup script using "chkconfig --add dbvnet" command.
- To review the startup options run "chkconfig --list dbvnetd" to view the status of the current start levels.
dbvnet
#!/bin/bash
echo -n $"Starting $prog:"
#
# /etc/rc.d/init.d/dbvnetd
#
# Starts the dbvnet daemon
#
# chkconfig: 345 95 5
# description: Dbvisit network infrastructure daemon. \
# Copyright (c) 2012 by Dbvisit Software Ltd. \
# All rights reserved.
# processname: dbvnet
# Source function library.
. /etc/init.d/functions
DBVISIT=/usr/dbvisit8 DBVNET=$DBVISIT/dbvnet/dbvnet
PIDFILE=$DBVISIT/dbvnet/conf/dbvnetd.pid
PATH=/usr/bin:/bin:/usr/sbin:/sbin
RETVAL=0
prog="dbvnet"
start() {
# Check if already running
su -l oracle -c "$DBVNET -d start"
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog:"
if [ -f "$PIDFILE" ]; then
su -l oracle -c "$DBVNET -d stop "
fi
RETVAL=$?
echo
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esacexit $?
exit $RETVAL
dbvagent
#!/bin/bash
echo -n $"Starting $prog:"
#
# /etc/rc.d/init.d/dbvagent
#
# Starts the dbvagent daemon
#
# chkconfig: 345 95 5
# description: Dbvisit network infrastructure daemon. \
# Copyright (c) 2012 by Dbvisit Software Ltd. \
# All rights reserved.
# processname: dbvagent
# Source function library.
. /etc/init.d/functions
DBVISIT=/usr/dbvisit8 DBVAGENT=$DBVISIT/dbvagent/dbvagent
PIDFILE=$DBVISIT/dbvagent/conf/dbvagent.pid
PATH=/usr/bin:/bin:/usr/sbin:/sbin
RETVAL=0
prog="dbvagent"
start() {
# Check if already running
su -l oracle -c "$DBVAGENT -d start"
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog:"
if [ -f "$PIDFILE" ]; then
su -l oracle -c "$DBVAGENT -d stop"
fi
RETVAL=$?
echo
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esacexit $?
exit $RETVAL
dbvserver
#!/bin/bash
echo -n $"Starting $prog:"
#
# /etc/rc.d/init.d/dbvserver
#
# Starts the dbvserver daemon
#
# chkconfig: 345 95 5
# description: Dbvisit network infrastructure daemon. \
# Copyright (c) 2012 by Dbvisit Software Ltd. \
# All rights reserved.
# processname: dbvserver
# Source function library.
. /etc/init.d/functions
DBVISIT=/usr/dbvisit8 DBVSERVER=$DBVISIT/dbvserver/dbvserver
PIDFILE=$DBVISIT/dbvserver/conf/dbvserver.pid
PATH=/usr/bin:/bin:/usr/sbin:/sbin
RETVAL=0
prog="dbvserver"
start() {
# Check if already running
su -l oracle -c "$DBVSERVER -d start"
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog:"
if [ -f "$PIDFILE" ]; then
su -l oracle -c "$DBVSERVER -d stop"
fi
RETVAL=$?
echo
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esacexit $?
exit $RETVAL
These scripts are missing a double quote on the ends of the echo starting lines