• Oracle GoldenGate微服务架构的服务Shell脚本


    Oracle GoldenGate微服务架构的/etc/init.d下的OracleGoldenGate服务Shell脚本:

    #!/bin/sh
    #
    # Oracle GoldenGate Service Manager
    #
    # Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
    #
    
    # chkconfig:        2345 99 95
    # 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:     2 3 5
    # Default-Stop:      0 1 4 6
    # 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 2>/dev/null)
        [[ ! -z ${pid} ]] &&         ps xaw | grep -q "^ *${pid}[ ].*${OGG_HOME}/bin/${PROGRAM}"
     }
    
    startService() {
        if ( isProgramRunning ); then
            echo "Oracle GoldenGate ${PROGRAM} already running"
            exit 1
        fi
        echo "Starting Oracle GoldenGate..."
        su - ${USER} -c "/bin/bash -c 'nohup ${OGG_HOME}/bin/${PROGRAM} &>/dev/null'" &
        RETVAL=$?
        [ ${RETVAL} -eq 0 ] && echo "Success" || echo "Failed"
    }
    
    stopService() {
        pid=$(cat ${OGG_VAR_HOME}/run/${PROGRAM}.pid 2>/dev/null)
        if ( ! isProgramRunning ); then
            echo "Oracle GoldenGate ${PROGRAM} not running"
            exit 1
        fi
        echo "Stopping Oracle GoldenGate..."
        kill ${pid}
        RETVAL=$?
        [ ${RETVAL} -eq 0 ] && echo "Success" || echo "Failed"
        sleep 2
    }
    
    status() {
        if ( ! isProgramRunning ); then
            echo "Oracle GoldenGate ${PROGRAM} not running"
            exit 1
        fi
        echo "Oracle GoldenGate ${PROGRAM} running"
        RETVAL=0
    }
    
    case "$1" in
        start)
            startService
            ;;
    
        stop)
            stopService
            ;;
    
        restart)
            stopService
            startService
            ;;
    
        status)
            status
            ;;
    
        *)
            echo $"Usage: $0 {start|stop|status|restart}"
            exit 1
    esac
    exit ${RETVAL}
  • 相关阅读:
    学习进度条(六)
    结对开发——-四则运算四
    结对开发——最大联通子数组的和
    团队项目成员和题目
    下载与安装APache Cordova
    学习进度条(五)
    构建之法阅读笔记05
    敏捷开发方法综述
    学习进度条(四)
    psp项目计划
  • 原文地址:https://www.cnblogs.com/ZeroTiny/p/9361340.html
Copyright © 2020-2023  润新知