| 1 | #!/bin/bash | 
|---|
| 2 | # | 
|---|
| 3 | # Begin $rc_base/init.d/cluster | 
|---|
| 4 | # | 
|---|
| 5 | # Based on sysklogd script from LFS-3.1 and earlier. | 
|---|
| 6 | # Written by Andrew "Weibullguy" Rowland <darowland@ieee.org> | 
|---|
| 7 | # | 
|---|
| 8 | # Date: 2007-10-31 | 
|---|
| 9 | # | 
|---|
| 10 | # Starts all of the services required for the cluster. | 
|---|
| 11 | # | 
|---|
| 12 | #       PBS Server | 
|---|
| 13 | #       MOM Client | 
|---|
| 14 | #       Maui Scheduler | 
|---|
| 15 | #       Ganglia Monitor Daemon | 
|---|
| 16 | #       Ganglia Meta-Monitor Daemon | 
|---|
| 17 | #       MPICH2 Process Monitor | 
|---|
| 18 |  | 
|---|
| 19 | . /etc/sysconfig/rc | 
|---|
| 20 | . $rc_functions | 
|---|
| 21 |  | 
|---|
| 22 | # Read in the command arguments | 
|---|
| 23 | case "$1" in | 
|---|
| 24 |  | 
|---|
| 25 | start) | 
|---|
| 26 | echo "#-------------------------------------------#" | 
|---|
| 27 | echo "Starting cluster services:" | 
|---|
| 28 |  | 
|---|
| 29 | # If the server daemon exists, then start it. | 
|---|
| 30 | if [ -f /usr/sbin/pbs_server ]; then | 
|---|
| 31 | boot_mesg "TORQUE PBS Server found; starting..." | 
|---|
| 32 | loadproc /usr/sbin/pbs_server | 
|---|
| 33 | fi | 
|---|
| 34 |  | 
|---|
| 35 | # If the mom daemon exists, then start it. | 
|---|
| 36 | if [ -f /usr/sbin/pbs_mom ]; then | 
|---|
| 37 | boot_mesg "TORQUE MOM Client found; starting..." | 
|---|
| 38 | loadproc /usr/sbin/pbs_mom | 
|---|
| 39 | fi | 
|---|
| 40 |  | 
|---|
| 41 | # If Maui Scheduler services exist on this node, then start it. | 
|---|
| 42 | if [ -f /usr/sbin/maui ]; then | 
|---|
| 43 | boot_mesg "Maui Batch scheduler found; starting..." | 
|---|
| 44 | loadproc /usr/sbin/maui | 
|---|
| 45 | fi | 
|---|
| 46 |  | 
|---|
| 47 | # If Ganglia monitor daemon exists, then start it. | 
|---|
| 48 | if [ -f /usr/sbin/gmond ]; then | 
|---|
| 49 | boot_mesg "Ganglia Monitoring Daemon found; starting..." | 
|---|
| 50 | loadproc /usr/sbin/gmond | 
|---|
| 51 | fi | 
|---|
| 52 |  | 
|---|
| 53 | # If Ganglia meta monitor daemon exists, start it. | 
|---|
| 54 | if [ -f /usr/sbin/gmetad ]; then | 
|---|
| 55 | boot_mesg "Ganglia Meta-Monitoring Daemon found; starting..." | 
|---|
| 56 | loadproc /usr/sbin/gmetad | 
|---|
| 57 | fi | 
|---|
| 58 |  | 
|---|
| 59 | # If MPICH2 process manager exists, then start it. | 
|---|
| 60 | if [ -f /usr/sbin/mpd ]; then | 
|---|
| 61 | boot_mesg "MPICH2 Process Manager found; starting..." | 
|---|
| 62 | loadproc /usr/sbin/mpd | 
|---|
| 63 | fi | 
|---|
| 64 |  | 
|---|
| 65 | echo "Cluster services running" | 
|---|
| 66 | echo "#-------------------------------------------#" | 
|---|
| 67 | ;; | 
|---|
| 68 |  | 
|---|
| 69 | stop) | 
|---|
| 70 | echo "#-------------------------------------------#" | 
|---|
| 71 | echo "Shutting down cluster services:" | 
|---|
| 72 |  | 
|---|
| 73 | boot_mesg "Stopping MPICH2 Process Monitor..." | 
|---|
| 74 | killproc mpd | 
|---|
| 75 | boot_mesg "Stopping Ganglia Meta-Monitoring Daemon..." | 
|---|
| 76 | killproc gmetad | 
|---|
| 77 | boot_mesg "Stopping Ganglia Monitoring Daemon..." | 
|---|
| 78 | killproc gmond | 
|---|
| 79 | boot_mesg "Stopping Maui Batch Scheduler..." | 
|---|
| 80 | killproc maui | 
|---|
| 81 | boot_mesg "Stopping TORQUE MOM Client ..." | 
|---|
| 82 | killproc pbs_mom | 
|---|
| 83 | boot_mesg "Stopping TORQUE PBS Server ..." | 
|---|
| 84 | killproc pbs_server | 
|---|
| 85 | echo "Cluster services stopped" | 
|---|
| 86 | echo "#-------------------------------------------#" | 
|---|
| 87 | ;; | 
|---|
| 88 |  | 
|---|
| 89 | restart) | 
|---|
| 90 | $0 stop | 
|---|
| 91 | $0 start | 
|---|
| 92 | ;; | 
|---|
| 93 |  | 
|---|
| 94 | status) | 
|---|
| 95 | echo "#-------------------------------------------#" | 
|---|
| 96 | echo "Status of cluster services:" | 
|---|
| 97 | statusproc /usr/sbin/pbs_server | 
|---|
| 98 | statusproc /usr/sbin/pbs_mom | 
|---|
| 99 | statusproc /usr/sbin/maui | 
|---|
| 100 | statusproc /usr/sbin/gmond | 
|---|
| 101 | statusproc /usr/sbin/gmetad | 
|---|
| 102 | statusproc /usr/sbin/mpd | 
|---|
| 103 | echo "#-------------------------------------------#" | 
|---|
| 104 | ;; | 
|---|
| 105 |  | 
|---|
| 106 | *) | 
|---|
| 107 | echo "Usage: $0 {start|stop|restart|status}" | 
|---|
| 108 | exit 1 | 
|---|
| 109 |  | 
|---|
| 110 | esac | 
|---|
| 111 |  | 
|---|
| 112 | exit 0 | 
|---|
| 113 |  | 
|---|
| 114 | # End $rc_base/init.d/cluster | 
|---|