We're here to help!

Auto startup/stop scripts for Dbvisit Standby v8 components using /etc/init.d

Follow

Read our docs 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
 
  1. An example startup script below can be placed in /etc/init.d/ directory. This should be owned by root user with execute permission.
  2. You can modify the "chkconfig: 345 95 5" line if required and then add the startup script using "chkconfig --add dbvnet" command.
  3. To review the startup options run "chkconfig --list dbvnetd" to view the status of the current start levels. 
NOTE: Below are example scripts for each of Dbvisit components. You can however, incorporate these into a single script and adjust the code accordingly.

dbvnet


#!/bin/bash
#
# /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
 
echo -n $"Starting $prog:
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
esac

exit $?
exit $RETVAL

 

dbvagent


#!/bin/bash
#
# /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
echo -n $"Starting $prog:
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
esac

exit $?
exit $RETVAL

 

dbvserver


#!/bin/bash
#
# /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
echo -n $"Starting $prog:
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
esac

exit $?
exit $RETVAL
Have more questions? Submit a request

Comments