Advertisement

09.23.2008 at 11:29AM PDT, ID: 23756021 | Points: 500
[x]
Attachment Details

How to use kill command in a start and stop script ?

Asked by rajsolaris in Shell Scripting, Bourne-Again Shell (bash)

Hi Experts,

Can you Please look into this script? stop scripts being called by the /etc/init.d/simapps script itself, are not stopping all processes I request to add some kill statements into the /etc/init.d/simapps script to ensure that all documentum processes are dead prior to allowing the start portion of the timsapps script from being ran.Please let me know if I  can proceed with building more logic into the simsapps script.  As a reference, here is what the current simsapps script looks like:



#!/sbin/sh
#
#
# script to stop/start all PCO processes

USER=`whoami`

if [ $USER = 'root' ]; then
        SUCMD='/usr/bin/su - pmadmin -c'
elif [ $USER = 'pmadmin' ]; then
        SUCMD=''
else
        echo "Script must be run as pmadmin or root"
        exit 1
fi


case "$1" in
start)
        $SUCMD /apps/documentum/dba/dm_launch_pcoap02local
        $SUCMD /apps/documentum/dba/dm_launch_pcoap02global
        $SUCMD /apps/documentum/dba/dm_start_axprep
        $SUCMD /apps/documentum/product/5.3/tomcat/bin/startup.sh
        ;;

stop)
        $SUCMD /apps/documentum/product/5.3/tomcat/bin/shutdown.sh
        $SUCMD /apps/documentum/dba/dm_shutdown_axprep
        $SUCMD /apps/documentum/dba/dm_stop_pcoap02global
        $SUCMD /apps/documentum/dba/dm_stop_pcoap02local
        ;;

restart)
        $SUCMD /apps/documentum/product/5.3/tomcat/bin/shutdown.sh
        $SUCMD /apps/documentum/dba/dm_shutdown_axprep
        $SUCMD /apps/documentum/dba/dm_stop_pcoap01global
        $SUCMD /apps/documentum/dba/dm_stop_pcoap01local
        sleep 5
        $SUCMD /apps/documentum/dba/dm_launch_pcoap01local
        $SUCMD /apps/documentum/dba/dm_launch_pcoap01global
        $SUCMD /apps/documentum/dba/dm_start_axprep
        $SUCMD /apps/documentum/product/5.3/tomcat/bin/startup.sh
        ;;

status)
        tput smso
        echo "###Local dmdocbroker running on port 1489, should be owned by pmadmin###"
        tput rmso
        /usr/bin/ps -ef | grep 'dmdocbroker -port 1489' | grep -v grep
        echo ""
        tput smso
        echo "###Global dmdocbroker running on port 1490 , should be owned by pmadmin###"
        tput rmso
        /usr/bin/ps -ef | grep 'dmdocbroker -port 1490' | grep -v grep
        echo ""
        tput smso
        echo "###Multiple documentum docbase_name with axprep name, should be owned by pmadmin###"
        tput rmso
        /usr/bin/ps -ef | grep 'documentum -docbase_name axprep' | grep -v grep
        echo ""
        tput smso
        echo "###Java app for Documentum, java under /apps/documentum path should be owned by pmadmin###"
        tput rmso
        /usr/bin/ps -ef | grep java | grep -v grep
        ;;

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


As you can see, this script actually calls the application startup/shutdown scripts as user dmadmin, rather than root.  I want to add process checking logic into the 'stop' portion of the script, as well as the 'start' portion to prevent any of the scripts being called prior to a complete shutdown of existing processes.

Please help adding the logic into......OR add some steps to the script.



Thanks In Advance.Start Free Trial
 
Loading Advertisement...
 
[+][-]09.23.2008 at 01:33PM PDT, ID: 22553751

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.23.2008 at 01:51PM PDT, ID: 22553925

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.23.2008 at 02:36PM PDT, ID: 22554393

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.23.2008 at 02:37PM PDT, ID: 22554411

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.23.2008 at 03:22PM PDT, ID: 22554785

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.23.2008 at 04:05PM PDT, ID: 22555006

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.24.2008 at 04:04PM PDT, ID: 22564944

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.25.2008 at 04:21AM PDT, ID: 22567904

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628