0% found this document useful (0 votes)
60 views

Script For Logic 1

The third document is a shell script that starts

Uploaded by

Ram Guggul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Script For Logic 1

The third document is a shell script that starts

Uploaded by

Ram Guggul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

#!

/bin/sh
#
### BEGIN INIT INFO
# Provides: clvm
# Required-Start: lvm2
# Required-Stop: lvm2
# Should-Start: cman corosync openais
# Should-Stop: cman corosync openais
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: start and stop the lvm cluster locking daemon
### END INIT INFO
#
# Author: Frederik Sch�ler <fs@debian.org>
# based on the old clvm init script from etch
# and the clvmd init script from RHEL5

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Cluster LVM Daemon"
NAME=clvm
DAEMON=/usr/sbin/clvmd
SCRIPTNAME=/etc/init.d/clvm

[ -x $DAEMON ] || exit 0

. /lib/init/vars.sh

. /lib/lsb/init-functions

if [ ! -f /etc/cluster/cluster.conf ]; then
log_failure_msg "clvmd: cluster not configured. Aborting."
exit 0
fi

if ! cman_tool status >/dev/null 2>&1; then


log_failure_msg "clvmd: cluster is not running. Aborting."
exit 0
fi

CLVMDTIMEOUT=20

# Read configuration variable file if it is present


[ -r /etc/default/$NAME ] && . /etc/default/$NAME

DAEMON_OPTS="-T$CLVMDTIMEOUT"

do_start()
{
start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS ||
status="$?"
# flush cache
vgscan > /dev/null 2>&1
return $status
}

do_activate()
{
if [ -n "$LVM_VGS" ] ; then
log_action_msg "Activating VGs $LVM_VGS"
vgchange -ayl $LVM_VGS || return $?
else
log_action_msg "Activating all VGs"
vgchange -ayl || return $?
fi
}

do_deactivate()
{
if [ -n "$LVM_VGS" ] ; then
vgs="$LVM_VGS"
else
# Hack to only deactivate clustered volumes
vgs=$(vgdisplay -C -o vg_name,vg_attr --noheadings 2> /dev/null | awk
'($2 ~ /.....c/) {print $1}')
fi

[ "$vgs" ] || return 0

vgchange -anl $vgs || return $?


}

do_stop()
{
start-stop-daemon --stop --quiet --name clvmd
status=$?
return $status
}

case "$1" in
start)
# start the daemon...
log_daemon_msg "Starting $DESC" "$NAME"
do_start
status=$?
case "$status" in
0) log_end_msg 0 ;;
1) log_action_msg " already running" ; log_end_msg 0 ;;
*) log_end_msg 1 ;;
esac
# and activate clustered volume groups
do_activate
status=$?
exit $status
;;
stop)
# deactivate volumes...
log_daemon_msg "Deactivating VG $vg:"
do_deactivate
status=$?
case "$status" in
0) log_end_msg 0 ;;
1) log_end_msg 0 ;;
*) log_end_msg 1 ;;
esac
# and stop the daemon
log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
status=$?
case "$status" in
0) log_end_msg 0 ; exit 0 ;;
1) log_end_msg 0 ; exit 0 ;;
*) log_end_msg 1 ; exit $status ;;
esac
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
status)
pid=$( pidof $DAEMON )
if [ -n "$pid" ] ; then
log_action_msg "$DESC is running"
else
log_action_msg "$DESC is not running"
fi
exit 0
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac

exit 0
--------------------------------------------------------------

[root@lxedmmdrdb1 ~]# cat /etc/rc.d/init.d/rawdevices


#!/bin/bash
#
# rawdevices This shell script assignes rawdevices to block devices
#
# chkconfig: 345 56 44
# description: This scripts assignes raw devices to block devices \
# (such as hard drive partitions). This is for the use \
# of applications such as Oracle. You can set up the \
# raw device to block device mapping by editing \
# the file /etc/sysconfig/rawdevices.
#
# config: /etc/sysconfig/rawdevices

[ -f /bin/raw ] || exit 0
[ -f /etc/sysconfig/rawdevices ] || exit 0
# Exit if the file just has the default comments.
LC_ALL=C /bin/egrep -q -v "^ *#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0

. /etc/init.d/functions

function assign_raw()
{
LC_ALL=C egrep -v '^ *#' /etc/sysconfig/rawdevices |
while read RAW BLOCK; do
if [ -n "$RAW" -a -n "$BLOCK" ]; then
rawdirname=${RAW%/*}
if [ "$rawdirname" = "/dev" -a -d /dev/raw ]; then
echo $" Please correct your /etc/sysconfig/rawdevices:"
echo $" rawdevices are now located in the directory /dev/raw/ "
echo $" If the command 'raw' still refers to /dev/raw as a file."
echo $" you'll have to upgrade your util-linux package"
exit 0
fi
if [ "$rawdirname" = "/dev/raw" -a -f /dev/raw ]; then
echo $" Please correct your /etc/sysconfig/rawdevices:"
echo $" rawdevices are now located in the directory /dev/raw/ "
echo $" If the command 'raw' still refers to /dev/raw as a file."
echo $" you'll have to upgrade your util-linux package"
exit 0
fi

echo " $RAW --> $BLOCK";


raw $RAW $BLOCK
fi
done
}

# See how we were called.


case "$1" in
start)
# Assign devices
echo $"Assigning devices: "
assign_raw
echo $"done"
;;
stop)
# No action to be taken here
;;

status)
ID=`id -u`
if [ $ID -eq 0 ]; then
raw -qa
else
echo $"You need to be root to use this command ! "
fi
;;

restart|reload)
$0 start
;;

*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac

exit 0
[root@lxedmmdrdb1 ~]#
-----------------------------------------------------------------------------------
#!/bin/sh
# chkconfig: 345 99 10
# description: Documentum auto start/stop script
# This script assumes that the dmadmin
# profile (i.e. .profile, .bash_profile) sets the Documentum environment
correctly
#
# Install command: chkconfig --add dctm
#
# Written by: Tony Rosete
#
#

# Set internal variables to appropriate values.


# HOME_DIR matches the location of clean_dctm_res.sh

DOCUMENTUM=/home/dmadmin/server
JMS_DIR=$DOCUMENTUM/shared/jboss4.3.0/server
DOCBASE_NAME=mydocbase
INSTALL_OWNER=dmadmin
HOME_DIR=/home/dmadmin

if [ ! -f $DOCUMENTUM/dba/dm_launch_Docbroker ]
then
echo "$DOCUMENTUM/dba/dm_lauch_Docbroker not found"
exit
fi

if [ ! -f $DOCUMENTUM/dba/dm_start_$DOCBASE_NAME ]
then
echo "$DOCUMENTUM/dba/dm_start_$DOCBASE_NAME not found"
exit
fi

if [ ! -f $JMS_DIR/startMethodServer.sh ]
then
echo "$JMS_DIR/startMethodServer.sh not found"
exit
fi

case "$1" in
'start')
# Start the docbroker
su - $INSTALL_OWNER -c $DOCUMENTUM/dba/dm_launch_Docbroker

# Start the docbase


sleep 2
echo ""
su - $INSTALL_OWNER -c $DOCUMENTUM/dba/dm_start_$DOCBASE_NAME

# Start the method server


sleep 5
echo ""
echo "Starting the method server"
su - $INSTALL_OWNER -c "nohup $JMS_DIR/startMethodServer.sh &>
$JMS_DIR/nohup.out & "

echo
echo "Documentum startup complete"
;;

'stop')
# Stop the docbase
su - $INSTALL_OWNER -c $DOCUMENTUM/dba/dm_shutdown_$DOCBASE_NAME

# Stop the method server


sleep 5
echo "Stopping the method server"
su - $INSTALL_OWNER -c $JMS_DIR/stopMethodServer.sh

# Stop the docbroker


sleep 5
su - $INSTALL_OWNER -c $DOCUMENTUM/dba/dm_stop_Docbroker

# cleanup any remaining dmadmin resources


echo ""
echo "Cleaning up Documentum resources"
su - $INSTALL_OWNER -c $HOME_DIR/clean_dctm_res.sh $INSTALL_OWNER

esac
-----------------------------------------------------------------------------------
-----------------------

You might also like