1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
#!/bin/bash
#
# opensm: Manage OpenSM
#
# chkconfig: - 09 91
# description: Manage OpenSM
#
### BEGIN INIT INFO
# Provides: opensm
# Required-Start: $syslog
# Default-Start: none
# Default-Stop: 0 1 6
# Description: Manage OpenSM
### END INIT INFO
#
# Copyright (c) 2008 Voltaire, Inc. All rights reserved.
# Copyright 2006 PathScale, Inc. All Rights Reserved.
#
# This Software is licensed under one of the following licenses:
#
# 1) under the terms of the "Common Public License 1.0" a copy of which is
# available from the Open Source Initiative, see
# http://www.opensource.org/licenses/cpl.php.
#
# 2) under the terms of the "The BSD License" a copy of which is
# available from the Open Source Initiative, see
# http://www.opensource.org/licenses/bsd-license.php.
#
# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
# copy of which is available from the Open Source Initiative, see
# http://www.opensource.org/licenses/gpl-license.php.
#
# Licensee has the right to choose one of the above licenses.
#
# Redistributions of source code must retain the above copyright
# notice and one of the license notices.
#
# Redistributions in binary form must reproduce both the above copyright
# notice, one of the license notices in the documentation
# and/or other materials provided with the distribution.
prefix=@prefix@
exec_prefix=@exec_prefix@
# Source function library.
if [[ -s /etc/init.d/functions ]]; then
. /etc/init.d/functions
rc_status() { :; }
rc_exit() { exit $RETVAL; }
fi
if [[ -s /etc/rc.status ]]; then
. /etc/rc.status
failure() { rc_status -v; }
success() { rc_status -v; }
fi
CONFIG=@sysconfdir@/sysconfig/opensm
if [[ -s $CONFIG ]]; then
. $CONFIG
fi
start () {
echo -n "Starting opensm: "
@sbindir@/opensm --daemon $OPTIONS > /dev/null
if [[ $RETVAL -eq 0 ]]; then
touch /var/lock/subsys/opensm
success
else
failure
fi
echo
}
stop () {
echo -n "Shutting down opensm: "
killproc opensm
if [[ $RETVAL -eq 0 ]]; then
rm -f /var/lock/subsys/opensm
success
else
failure
fi
echo
}
Xstatus () {
pid="`pidof opensm`"
ret=$?
if [ $ret -eq 0 ] ; then
echo "OpenSM is running... pid=$pid"
else
echo "OpenSM is not running."
fi
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
Xstatus
;;
restart | force-reload | reload)
restart
;;
try-restart | condrestart)
[ -e /var/lock/subsys/opensm ] && restart
;;
resweep)
killall -HUP opensm
RETVAL=$?
;;
rotatelog)
killall -USR1 opensm
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart|resweep|rotatelog}"
RETVAL=1
;;
esac
_rc_status_all=$RETVAL
rc_exit
|