~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/dist/util/install_modules/inst_qmaster_uninst.sh

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# SGE configuration script (Installation/Uninstallation/Upgrade/Downgrade)
 
4
# Scriptname: inst_qmaster_uninst.sh
 
5
#
 
6
#___INFO__MARK_BEGIN__
 
7
##########################################################################
 
8
#
 
9
#  The Contents of this file are made available subject to the terms of
 
10
#  the Sun Industry Standards Source License Version 1.2
 
11
#
 
12
#  Sun Microsystems Inc., March, 2001
 
13
#
 
14
#
 
15
#  Sun Industry Standards Source License Version 1.2
 
16
#  =================================================
 
17
#  The contents of this file are subject to the Sun Industry Standards
 
18
#  Source License Version 1.2 (the "License"); You may not use this file
 
19
#  except in compliance with the License. You may obtain a copy of the
 
20
#  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
21
#
 
22
#  Software provided under this License is provided on an "AS IS" basis,
 
23
#  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
24
#  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
25
#  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
26
#  See the License for the specific provisions governing your rights and
 
27
#  obligations concerning the Software.
 
28
#
 
29
#  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
30
#
 
31
#  Copyright: 2001 by Sun Microsystems, Inc.
 
32
#
 
33
#  All Rights Reserved.
 
34
#
 
35
##########################################################################
 
36
#___INFO__MARK_END__
 
37
#
 
38
# set -x
 
39
 
 
40
RemoveQmaster()
 
41
{
 
42
   $INFOTEXT -u "Uninstalling qmaster host"
 
43
   $INFOTEXT -n "You're going to uninstall the qmaster host now. If you are not sure,\n" \
 
44
                "what you are doing, please stop with <CTRL-C>. This procedure will, remove\n" \
 
45
                "the complete cluster configuration and all spool directories!\n" \
 
46
                "Please make a backup from your cluster configuration!\n\n"
 
47
   if [ $AUTO = "false" ]; then
 
48
      $INFOTEXT -n -ask "y" "n" -def "n" "Do you want to uninstall the master host? [n] >> "
 
49
   fi
 
50
 
 
51
   if [ $? = 0 ]; then
 
52
      $INFOTEXT -n "We're going to uninstall the master host now!\n"
 
53
      CheckRegisteredExecd
 
54
 
 
55
   else
 
56
      MoveLog
 
57
      exit 0 
 
58
   fi
 
59
}
 
60
 
 
61
CheckRegisteredExecd()
 
62
{
 
63
   $INFOTEXT -n "Checking Running Execution Hosts\n"
 
64
   $INFOTEXT -log -n "Checking Running Execution Hosts\n"
 
65
   
 
66
   registered=`qconf -sel`
 
67
 
 
68
     if [ "$registered" = "" ]; then
 
69
        :
 
70
     else
 
71
        $INFOTEXT "Found registered execution hosts, exiting uninstallation!\n"
 
72
        $INFOTEXT -log "Found registered execution hosts, exiting uninstallation!\n"
 
73
        MoveLog
 
74
        exit 1 
 
75
     fi
 
76
 
 
77
   $INFOTEXT "There are no running execution host registered!\n"
 
78
   $INFOTEXT -log "There are no running execution host registered!\n"
 
79
   ShutdownMaster
 
80
   
 
81
 
 
82
}
 
83
 
 
84
ShutdownMaster()
 
85
{
 
86
   euid=`$SGE_UTILBIN/uidgid -euid`
 
87
   GetAdminUser
 
88
   
 
89
   if [ "$SGE_ENABLE_SMF" != "true" ]; then
 
90
      $INFOTEXT "Shutting down qmaster!"
 
91
      $INFOTEXT -log "Shutting down qmaster!"
 
92
      spool_dir_master=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap | grep qmaster_spool_dir | awk '{ print $2 }'`
 
93
      master_pid=`cat $spool_dir_master/qmaster.pid`
 
94
 
 
95
      `qconf -km`
 
96
 
 
97
      ret=0
 
98
      while [ $ret -eq 0 ]; do 
 
99
         sleep 5
 
100
         if [ -f $master_pid ]; then
 
101
            $SGE_UTILBIN/checkprog $master_pid sge_qmaster > /dev/null
 
102
            ret=$?
 
103
         else
 
104
            ret=1
 
105
         fi
 
106
         $INFOTEXT "sge_qmaster is going down ...., please wait!"
 
107
      done
 
108
 
 
109
      $INFOTEXT "sge_qmaster is down!"
 
110
   fi
 
111
 
 
112
   master_spool=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap | grep qmaster_spool_dir | awk '{ print $2 }'`
 
113
 
 
114
   RemoveRcScript $HOST master $euid
 
115
 
 
116
   $INFOTEXT "Removing qmaster spool directory!"
 
117
   $INFOTEXT -log "Removing qmaster spool directory!"
 
118
   RM="rm -fR"
 
119
   ExecuteAsAdmin $RM $master_spool
 
120
 
 
121
   berkeley_spool=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap | grep spooling_params | awk '{ print $2 }'`
 
122
 
 
123
   $INFOTEXT "Removing berkeley spool directory!"
 
124
   $INFOTEXT -log "Removing berkeley spool directory!"
 
125
   ExecuteAsAdmin $RM $berkeley_spool
 
126
 
 
127
   $INFOTEXT "Removing %s directory!" $SGE_CELL
 
128
   $INFOTEXT -log "Removing %s directory!" $SGE_CELL
 
129
   ExecuteAsAdmin $RM $SGE_CELL
 
130
}