Oracle GoldenGate微服务架构的/etc/init.d下的OracleGoldenGate服务Shell脚本:
#!/bin/sh
#
# Oracle GoldenGate Service Manager
#
# Copyright (c) , Oracle and/or its affiliates. All rights reserved.
# # chkconfig:
# description: The Oracle GoldenGate Service Manager is # responsible for managing all other Oracle # GoldenGate services.
# processname: ServiceManager ### BEGIN INIT INFO
# Provides: OracleGoldenGate
# Required-Start: $syslog $remote_fs $network $named $time
# Default-Start:
# Default-Stop:
# Short-Description: Oracle GoldenGate Service Manager
# Description: The Oracle GoldenGate Service Manager is responsible for
# managing all other Oracle GoldenGate services.
### END INIT INFO PROGRAM="ServiceManager"
USER=oggma
OGG_HOME=/home/oggma/app/oggma
OGG_VAR_HOME=/home/oggma/app/oggsm/var isProgramRunning() {
pid=$(cat ${OGG_VAR_HOME}/run/${PROGRAM}.pid >/dev/null)
[[ ! -z ${pid} ]] && ps xaw | grep -q "^ *${pid}[ ].*${OGG_HOME}/bin/${PROGRAM}"
} startService() {
if ( isProgramRunning ); then
echo "Oracle GoldenGate ${PROGRAM} already running"
exit
fi
echo "Starting Oracle GoldenGate..."
su - ${USER} -c "/bin/bash -c 'nohup ${OGG_HOME}/bin/${PROGRAM} &>/dev/null'" &
RETVAL=$?
[ ${RETVAL} -eq ] && echo "Success" || echo "Failed"
} stopService() {
pid=$(cat ${OGG_VAR_HOME}/run/${PROGRAM}.pid >/dev/null)
if ( ! isProgramRunning ); then
echo "Oracle GoldenGate ${PROGRAM} not running"
exit
fi
echo "Stopping Oracle GoldenGate..."
kill ${pid}
RETVAL=$?
[ ${RETVAL} -eq ] && echo "Success" || echo "Failed"
sleep
} status() {
if ( ! isProgramRunning ); then
echo "Oracle GoldenGate ${PROGRAM} not running"
exit
fi
echo "Oracle GoldenGate ${PROGRAM} running"
RETVAL=
} case "$1" in
start)
startService
;; stop)
stopService
;; restart)
stopService
startService
;; status)
status
;; *)
echo $"Usage: $0 {start|stop|status|restart}"
exit
esac
exit ${RETVAL}