~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to debian/slurm-llnl.init.d

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#
16
16
### BEGIN INIT INFO
17
17
# Provides:          slurm
18
 
# Required-Start:    $local_fs $syslog $network $named munge
19
 
# Required-Stop:     $local_fs $syslog $network $named munge
20
 
# Default-Start:     3 5
21
 
# Default-Stop:      0 1 2 6
 
18
# Required-Start:    $remote_fs $syslog $network munge
 
19
# Required-Stop:     $remote_fs $syslog $network munge
 
20
# Should-Start:      $named
 
21
# Should-Stop:       $named
 
22
# Default-Start:     2 3 4 5
 
23
# Default-Stop:      0 1 6
22
24
# Short-Description: slurm daemon management
23
25
# Description:       Start slurm to provide resource management
24
26
### END INIT INFO
43
45
    fi
44
46
      echo slurm.conf was not found in $CONFDIR
45
47
      echo Please follow the instructions in \
46
 
            /usr/share/doc/slurm-llnl/README.Debian
 
48
            /usr/share/doc/slurm-llnl/README.Debian.gz
47
49
    exit 0
48
50
fi
49
51
 
87
89
  certfile=""
88
90
 
89
91
  if [ "$1" = "slurmd" ] ; then 
90
 
    certfile=$(grep JobCredentialPublicCertificate $CONFDIR/slurm.conf \
 
92
    keyfile=$(grep JobCredentialPublicCertificate $CONFDIR/slurm.conf \
91
93
                  | grep -v "^ *#")
92
 
    certfile=${certfile##*=}
93
 
    certfile=${certfile%#*}
94
 
    [ -e $certfile ] || MISSING="$certfile"
 
94
    keyfile=${keyfile##*=}
 
95
    keyfile=${keyfile%#*}
 
96
    [ -e $keyfile ] || MISSING="$keyfile"
95
97
  elif [ "$1" = "slurmctld" ] ; then 
96
98
    keyfile=$(grep JobCredentialPrivateKey $CONFDIR/slurm.conf | grep -v "^ *#")
97
99
    keyfile=${keyfile##*=}
103
105
    echo Not starting slurm-llnl
104
106
    echo $MISSING not found
105
107
    echo Please follow the instructions in \
106
 
          /usr/share/doc/slurm-llnl/README.Debian
 
108
          /usr/share/doc/slurm-llnl/README.cryptotype-openssl
107
109
    exit 0
108
110
  fi
109
111
 
110
 
  if [ -f $keyfile ] ; then
 
112
  if [ -f "$keyfile" ] && [ "$1" = "slurmctld" ] ; then
111
113
    keycheck=$(openssl-vulnkey $keyfile | cut -d : -f 1)
112
114
    if [ "$keycheck" = "COMPROMISED" ] ; then 
113
 
 
114
 
 
115
115
      echo Your slurm key stored in the file $keyfile
116
116
      echo is vulnerable because has been created with a buggy openssl.
117
117
      echo Please rebuild it with openssl version \>= 0.9.8g-9
140
140
  CRYPTOTYPE=$(grep CryptoType $CONFDIR/slurm.conf | grep -v "^ *#")
141
141
  CRYPTOTYPE=${CRYPTOTYPE##*=}
142
142
  CRYPTOTYPE=${CRYPTOTYPE%#*}
143
 
  if [ "$CRYPTOTYPE" = "crypto/openssl" ] || [ "$CRYPTOTYPE" = "" ] ; then
 
143
  if [ "$CRYPTOTYPE" = "crypto/openssl" ] ; then
144
144
    checkcertkey $1
145
145
  fi
146
146
 
 
147
  # Create run-time variable data
 
148
  mkdir -p /var/run/slurm-llnl
 
149
  chown slurm:slurm /var/run/slurm-llnl
 
150
 
 
151
  # Checking if SlurmdSpoolDir is under run
 
152
  if [ "$1" = "slurmd" ] ; then
 
153
    SDIRLOCATION=$(grep SlurmdSpoolDir /etc/slurm-llnl/slurm.conf \
 
154
                       | grep -v "^ *#")
 
155
    SDIRLOCATION=${SDIRLOCATION##*=}
 
156
    SDIRLOCATION=${SDIRLOCATION%#*}
 
157
    if [ "${SDIRLOCATION}" = "/var/run/slurm-llnl/slurmd" ] ; then
 
158
      if ! [ -e /var/run/slurm-llnl/slurmd ] ; then
 
159
        ln -s /var/lib/slurm-llnl/slurmd /var/run/slurm-llnl/slurmd
 
160
      fi
 
161
    fi
 
162
  fi
 
163
    
 
164
  # Checking if StateSaveLocation is under run
 
165
  if [ "$1" = "slurmctld" ] ; then
 
166
    SDIRLOCATION=$(grep StateSaveLocation /etc/slurm-llnl/slurm.conf \
 
167
                       | grep -v "^ *#")
 
168
    SDIRLOCATION=${SDIRLOCATION##*=}
 
169
    SDIRLOCATION=${SDIRLOCATION%#*}
 
170
    if [ "${SDIRLOCATION}" = "/var/run/slurm-llnl/slurmctld" ] ; then
 
171
      if ! [ -e /var/run/slurm-llnl/slurmctld ] ; then
 
172
        ln -s /var/lib/slurm-llnl/slurmctld /var/run/slurm-llnl/slurmctld
 
173
      fi
 
174
    fi
 
175
  fi
 
176
 
147
177
  desc="$(get_daemon_description $1)"
148
178
  log_daemon_msg "Starting $desc" "$1"
149
179
  unset HOME MAIL USER USERNAME 
217
247
        if [ "$rpid" != "" -a "$pid" != "" ]; then
218
248
            for i in $pid ; do
219
249
                if [ "$i" = "$rpid" ]; then 
220
 
                    echo $"${base} (pid $pid) is running..."
 
250
                    echo "${base} (pid $pid) is running..."
221
251
                    return 0
222
252
                fi     
223
253
            done
225
255
#           Due to change in user id, pid file may persist 
226
256
#           after slurmctld terminates
227
257
            if [ "$base" != "slurmctld" ] ; then
228
 
               echo $"${base} dead but pid file exists"
 
258
               echo "${base} dead but pid file exists"
229
259
            fi
230
260
            return 1
231
261
        fi 
233
263
    fi
234
264
 
235
265
    if [ "$base" = "slurmctld" -a "$pid" != "" ] ; then
236
 
        echo $"${base} (pid $pid) is running..."
 
266
        echo "${base} (pid $pid) is running..."
237
267
        return 0
238
268
    fi
239
269
     
240
 
    echo $"${base} is stopped"
 
270
    echo "${base} is stopped"
241
271
    
242
272
    return 3
243
273
}
249
279
slurmstop() {
250
280
    for prog in $DAEMONLIST ; do
251
281
       stop $prog
252
 
#       for i in 1 2 3 4
253
 
#       do
254
 
#          sleep $i
255
 
#          slurmstatus $prog
256
 
#          if [ $? != 0 ]; then
257
 
#             break
258
 
#          fi
259
 
#       done
 
282
       for i in 1 2 3 4
 
283
       do
 
284
          sleep $i
 
285
          slurmstatus $prog
 
286
          if [ $? != 0 ]; then
 
287
             break
 
288
          fi
 
289
       done
260
290
    done
261
291
}
262
292
 
286
316
        ;;
287
317
    restart)
288
318
        $0 stop
289
 
        sleep 1
290
319
        $0 start
291
320
        ;;
292
321
    force-reload)