#!/bin/sh # # $Id:$ # # Copyright 2007 Platform Computing Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # # This script is responsible for starting the CFMD # chkconfig: - 99 99 # description: Cluster File Manager for Kusu ### BEGIN INIT INFO # Provides: cfmd # Required-Start: $local_fs $remote_fs $network cfmclient # Should-Start: $time postgresql mysql # Required-Stop: # Default-Start: 3 5 # Default-Stop: # description: Cluster File Manager for Kusu ### END INIT INFO . /lib/lsb/init-functions prog='cfmd' ## For cfmd, the following is not respected when it spawns ## cfmclient child processes. # export PYTHONPATH=/opt/kusu/lib/python start() { echo -n $"Starting $prog. " # Is the CFMD running if [ -n "`/sbin/pidof -o %PPID $prog`" ]; then echo -n "$prog: already running" log_failure_msg echo return 1 fi if [ ! -f /etc/profile.nii ]; then echo echo -n "Cannot run CFMd on the primary installer. " log_success_msg echo return 0 fi if [ -x /opt/kusu/sbin/cfmd ]; then /opt/kusu/sbin/cfmd RETVAL=$? else echo -n "$prog: not found" RETVAL=1 fi [ $RETVAL -eq 0 ] && log_success_msg || log_failure_msg echo return $RETVAL } stop() { # Stop daemons. echo -n $"Stopping $prog: " RETVAL=0 if /sbin/pidof -o %PPID $prog >/dev/null; then killproc $prog -TERM >/dev/null 2>&1 RETVAL=$? fi; [ $RETVAL -eq 0 ] && log_success_msg || log_failure_msg echo return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac