Está en la página 1de 3

Autor: Jaime Crdenas Duarte

Email: customvalem@yahoo.com

Objetivo.
Crear un script, que inicie los dispositivos raw, para multipath, en cualquier versin de Linux.

Descripcin.

Este programa se ubica en /etc/init.d, con el nombre de rawdevicesmanual

# Contenido de "/etc/init.d/rawdevicesmanual "
cat /etc/init.d/rawdevicesmanual
[root@server02 init.d]# cat /etc/init.d/ rawdevicesmanual
#!/bin/sh
#
# Device raw Starts/stop the " rawdevicesmanual" daemon
#
# chkconfig: 345 95 5


### BEGIN INIT INFO
# Provides: rawdevicesmanual at batch
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 345
# Default-Stop: 95
# Short-Description: Starts/stop/status the " rawdevicesmanual " daemon
# Description: Use para poder ver el status, detener o/y
# iniciar disposibivos raw
### END INIT INFO

# Source function library.

start() {
echo "se reinicia multipath"
/etc/init.d/multipathd restart
delay 2
echo "Se inician discos raw "
/bin/raw /dev/raw/raw7 /dev/mapper/lv_disco01
/bin/raw /dev/raw/raw8 /dev/mapper/lv_disco02

# Se espera 2 segundos
sleep 2

# Se cambia permisos de propietarios
/bin/chown mydisk:mydisk /dev/raw/raw7 /dev/raw/raw8

# Se crea los acceso directos

/bin/ln -s /dev/raw/raw7 /dev/my_disco_01_raw
/bin/ln -s /dev/raw/raw8 /dev/my_disco_02_raw

/bin/chown -R mydisk:mydisk /dev/ my_disco_0*
}
stop() {
/bin/raw -qa

}
restart() {
stop
start
}

reload() {
restart
}

force_reload() {
restart
}

rh_status() {
# run checks to determine if the service is running or use generic
status
# status $prog
echo "Estatus de raw -qa "
/bin/raw -qa
}

rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
$1
;;
stop)
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-
restart|reload|force-reload}"
exit 2
esac
exit $?

También podría gustarte