update dbora init

This commit is contained in:
Yacine31
2021-06-24 10:20:05 +02:00
parent dcb2c170bb
commit a263b6235d
3 changed files with 49 additions and 65 deletions

View File

@@ -10,9 +10,12 @@
# copy du fichier oracledb dans /etc/init.d pour redémmarage auto
# ---------------------------------------------------
- name: Copie du script de démarrage auto des bases Oracle
template: src=oracledb_initd.j2 dest=/etc/init.d/oracle_db owner=root mode=755
template: src=dbora_initd.j2 dest=/etc/init.d/dbora owner=root mode=755
- debug: msg="Le script /etc/init.d/oracle_db est postionné pour démarrer et arrêter les bases au reboot"
- name: Activation par chkconfig du script de démarrage auto des bases Oracle
service: name=dbora enabled=yes
- debug: msg="Le script /etc/init.d/dbora est postionné pour démarrer et arrêter les bases au reboot"
- debug: msg="Pensez à mettre Y au lieu de N dans /etc/oratab pour les bases à démarreage automatique"
- debug: msg="Pensez aussi à activier le script par chkconfig ou systemd"

View File

@@ -0,0 +1,44 @@
#!/bin/bash
#
#
# chkconfig: 35 98 08
#
# description: Oracle auto start-stop script.
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORACLE_HOME.
ORA_HOME={{ db_home }}
ORACLE_HOME_LISTENER={{ db_home }}
ORA_OWNER={{ oracle_user }}
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
# Remove "&" if you don't want startup as a background process.
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"
touch /var/lock/subsys/dbora
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"
rm -f /var/lock/subsys/dbora
;;
'restart')
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac

View File

@@ -1,63 +0,0 @@
#!/bin/bash
#
#
# chkconfig: 35 98 08
### BEGIN INIT INFO
# Short-Description: start and stop db, oms and agent
# Description: start and stop db, oms and agent
### END INIT INFO
# Source function library.
. /etc/init.d/functions
prog=oracledb
lockfile=/var/lock/subsys/$prog
export ORACLE_HOME={{ db_home }}
start() {
[ "$NETWORKING" = "no" ] && exit 1
# Start daemons.
echo -n $"Starting $prog: "
# Start everything
su - oracle -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $lockfile
return $RETVAL
}
stop() {
[ "$EUID" != "0" ] && exit 4
echo -n $"Shutting down $prog: "
# stop everything
su - oracle -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $lockfile
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac