Controlar tempo do shutdown

1. Controlar tempo do shutdown

Rosemary Passos Silva
roserps

(usa Outra)

Enviado em 12/04/2013 - 09:50h

Olá pessoal!

Sou iniciante em Linux e estou com dificuldade para implantar uma rotina. Preciso que alguns serviços sejam finalizados antes da máquina desligar completamente, porém mesmo com o script na init.d e com os links no rc.d, quando desligo a máquina o killall finaliza antes do meu script concluir. Vocês sabem me informar se tem alguma forma de controlar o tempo de finalização da máquina entre a execução do shutdown e o killall? Ou se há alguma de eu criar uma dependência para que o killall seja executado apenas após a conclusão do script? Uso Oracle Linux.


  


2. Re: Controlar tempo do shutdown

Daniel Lara Souza
danniel-lara

(usa Fedora)

Enviado em 12/04/2013 - 10:06h

posta ai o seu script para podemos analisar


3. Re: Controlar tempo do shutdown

Rosemary Passos Silva
roserps

(usa Outra)

Enviado em 12/04/2013 - 10:23h


#!/bin/bash
#
# File: /etc/init.d/obiee11g
# Purpose: Start and stop Oracle Business Intelligence 11g components.
#
# chkconfig: 035 99 01
# description: Manage OBIEE service.

# chmod +x /etc/init.d/obiee11g

# Automatic start/stop during boot sequence:
# chkconfig --add obiee
# chkconfig obiee on
# or
# ln -s /etc/init.d/obiee11g /etc/rc.d/rc0.d/K01obiee11g
# ln -s /etc/init.d/obiee11g /etc/rc.d/rc3.d/S99obiee11g
# ln -s /etc/init.d/obiee11g /etc/rc.d/rc5.d/S99obiee11g

# Note that in order for the procedure to go through smoothly, you need to provide the admin credentials (username/password, defaulting to weblogic/weblogic) in three different places:
# 1. In configuration file <FMW_HOME>/user_projects/domains/<domain name>/servers/AdminServer/security/boot.properties for the administration server;
# 2. In script <FMW_HOME>/user_projects/domains/<domain name>/bin/startManagedWebLogic.sh (variables WLS_USER and WLS_PW) for the managed server;
# 3. In the startup script itself (variables BIEE_USER and BIEE_PASSWD) for shutting down the managed server.

# Complete logs are available in /var/log/obiee-start (-stop).log files.




# These values must be adapted to your environment.

ORACLE_OWNR=oracle # Local Unix user running OBIEE
ORACLE_FMW=/u01/Oracle/Middleware # Deployment root directory

BIEE_USER=weblogic # BIEE administrator name
BIEE_PASSWD=senha # BIEE administrator password
BIEE_DOMAIN=bifoundation_domain # Domain name
BIEE_INSTANCE=instance1 # Instance name
BIEE_SERVER=bi_server1 # BI Server name
ODI_SERVER=odi_server1 # ODI Server name
BIEE_MANAGER_URL=localhost:7001 # Admin server URL (hostname:port)

# These should require no change.

WL_PATH=$ORACLE_FMW/wlserver_10.3/server/bin
BIEE_PATH=$ORACLE_FMW/user_projects/domains/$BIEE_DOMAIN/bin
ORACLE_INSTANCE=$ORACLE_FMW/instances/$BIEE_INSTANCE

export ORACLE_INSTANCE

START_LOG=/var/log/obiee-start.log
STOP_LOG=/var/log/obiee-stop.log
SUBSYS=obiee

start() {
echo "********************************************************************************"
echo "Starting Admin Server on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$BIEE_PATH/startWebLogic.sh" &
wait_for "Server started in RUNNING mode"

echo "********************************************************************************"
echo "Starting Node Manager on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$WL_PATH/startNodeManager.sh" &
wait_for "socket listener started on port"

echo "********************************************************************************"
echo "Starting Managed Server $BIEE_SERVER on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$BIEE_PATH/startManagedWebLogic.sh $BIEE_SERVER http://$BIEE_MANAGER_URL" &
wait_for "Server started in RUNNING mode"
echo "********************************************************************************"
echo "Starting Managed Server $ODI_SERVER on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$BIEE_PATH/startManagedWebLogic.sh $ODI_SERVER http://$BIEE_MANAGER_URL" &

echo "********************************************************************************"
echo "Starting BI components on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$ORACLE_INSTANCE/bin/opmnctl startall"
wait_for "Server started in RUNNING mode"

echo "********************************************************************************"
echo "OBIEE start sequence completed on $(date)"
echo "********************************************************************************"
}

stop() {
echo "********************************************************************************"
echo "Stopping BI components on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$ORACLE_INSTANCE/bin/opmnctl stopall"

echo "********************************************************************************"
echo "Stopping Managed Server $BIEE_SERVER on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$BIEE_PATH/stopManagedWebLogic.sh $BIEE_SERVER t3://$BIEE_MANAGER_URL $BIEE_USER $BIEE_PASSWD"
echo "********************************************************************************"
echo "Stopping Managed Server $ODI_SERVER on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$BIEE_PATH/stopManagedWebLogic.sh $ODI_SERVER t3://$BIEE_MANAGER_URL $BIEE_USER $BIEE_PASSWD"

echo "********************************************************************************"
echo "Stopping Node Manager on $(date)"
echo "********************************************************************************"
pkill -TERM -u $ORACLE_OWNR -f "weblogic\\.NodeManager"

echo "********************************************************************************"
echo "Stopping Admin Server on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$BIEE_PATH/stopWebLogic.sh"

echo "********************************************************************************"
echo "OBIEE 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
start)
echo "********************************************************************************"
echo "Starting Oracle Business Intelligence on $(date)"
echo "Logs are sent to $START_LOG"
echo "********************************************************************************"
start &> $START_LOG &
touch /var/lock/subsys/$SUBSYS
;;
stop)
echo "********************************************************************************"
echo "Stopping Oracle Business Intelligence on $(date)"
echo "Logs are sent to $STOP_LOG"
echo "********************************************************************************"
stop &> $STOP_LOG
rm -f /var/lock/subsys/$SUBSYS
;;
status)
echo "********************************************************************************"
echo "Oracle BIEE components status...."
echo "********************************************************************************"
su $ORACLE_OWNR -c "$ORACLE_INSTANCE/bin/opmnctl status"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $(basename $0) start|stop|restart|status"
exit 1
esac

exit 0
}







Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts