Friday, 23 November 2012

Linux Start/Stop script for EPM


A while ago I published a generic linux start/stop script for OBIEE (obiee_start_stop.sh), well here is a similar script for EPM (epm_start_stop.sh)

It's only for the base EPM product (including Essbase), it doesn't not include any of the additional products - hyperion planning etc., although it could be extended to include starting additional products.

It requires one of four arguments:

start          Starts EPM Services
stop          Stops EPM Services
restart       Performs a Stop followed by a Start
fullstart    When EPM is first started (or after a server reboot) the nodemanager service needs
                 starting in addition to the weblogic and EPM services. The nodemanager does not get
                 stopped during a normal stop process, so isn't included in the normal start process above.

There are four variables which need to be modified to suit your environment near the top of the file - the linux user id under which you are running the services, the home directory for the EPM middleware and both the EPM and Domain instance names (as created during the install)



epm_start_stop.sh

#!/bin/bash
# These values must be adapted to your environment.

ORACLE_OWNR=linuxuserid                            # Local Unix user running Essbase
ORACLE_FMW=MiddlewareHomeDirectory        # Deployment home directory
EPM_INSTANCE=InstanceName                       # EPM Instance name
EPM_DOMAIN=DomainName                           # EPM Domain name

# These should require no change.
WL_PATH=$ORACLE_FMW/wlserver_10.3/server/bin
WL_DOMAIN_PATH=$ORACLE_FMW/user_projects/domains/$EPM_DOMAIN/bin
EPM_PATH=$ORACLE_FMW/user_projects/$EPM_INSTANCE/bin
NOW=$(date +"%Y%m%d-%H%M")


START_LOG=~/logs/epm-start-$NOW.log
STOP_LOG=~/logs/epm-stop-$NOW.log
SUBSYS=epm

fullstart() {
#echo "********************************************************************************"
#echo "Starting Node Manager on $(date)"
#echo "********************************************************************************"
$WL_PATH/startNodeManager.sh &
wait_for "socket listener started on port"
echo "********************************************************************************"
echo "Starting Weblogic Server on $(date)"
echo "********************************************************************************"
$WL_DOMAIN_PATH/startWebLogic.sh &
wait_for "Server started in RUNNING mode"
echo "********************************************************************************"
echo "Starting EPM Services on $(date)"
echo "********************************************************************************"
$EPM_PATH/start.sh
echo "********************************************************************************"
echo "EPM start sequence completed on $(date)"
echo "********************************************************************************"
}
echo "********************************************************************************"
echo "Starting Weblogic Server on $(date)"
echo "********************************************************************************"
$WL_DOMAIN_PATH/startWebLogic.sh &
wait_for "Server started in RUNNING mode"
echo "********************************************************************************"
echo "Starting EPM Services on $(date)"
echo "********************************************************************************"
$EPM_PATH/start.sh
echo "********************************************************************************"
echo "EPM start sequence completed on $(date)"
echo "********************************************************************************"
}
stop() {
echo "********************************************************************************"
echo "Stopping EPM Services on $(date)"
echo "********************************************************************************"
$EPM_PATH/stop.sh
echo "********************************************************************************"
echo "Starting Weblogic Server on $(date)"
echo "********************************************************************************"
$WL_DOMAIN_PATH/stopWebLogic.sh
echo "********************************************************************************"
echo "Essbase stop sequence completed on $(date)"
echo "********************************************************************************"
}
wait_for() {
res=0
while [[ ! $res -gt 0 ]]
do
res=$(tail -5 "$START_LOG" | fgrep -c "$1")
sleep 5
done
}

case "$1" in
fullstart)
echo "********************************************************************************"
echo "Starting EPM on $(date)"
echo "View Log with: tail -f $START_LOG"
echo "********************************************************************************"
fullstart &> $START_LOG &
# touch /var/lock/subsys/$SUBSYS
;;
start)
echo "********************************************************************************"
echo "Starting EPM on $(date)"
echo "View Log with: tail -f $START_LOG"
echo "********************************************************************************"
start &> $START_LOG &
# touch /var/lock/subsys/$SUBSYS
;;
stop)
echo "********************************************************************************"
echo "Stopping EPM on $(date)"
echo "Logs are sent to $STOP_LOG"
echo "********************************************************************************"
stop &> $STOP_LOG
# rm -f /var/lock/subsys/$SUBSYS
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $(basename $0) start|stop|restart|fullstart"
exit 1
esac
exit 0

1 comment: