#!/bin/bash # Copyright 2011 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # imagefactory init file for Image Factory # # chkconfig: - 99 1 # description: Image Factory tool # # processname: /usr/bin/imagefactory ### BEGIN INIT INFO # Provides: imagefactory # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Should-Start: # Should-Stop: # Default-Start: # Default-Stop: # Short-Description: start and stop Image Factory daemon # Description: Image Factory ### END INIT INFO # source function library . /etc/init.d/functions if [ -r /etc/sysconfig/imagefactory ]; then . /etc/sysconfig/imagefactory fi RETVAL=0 prog="imagefactory" binary=/usr/bin/imagefactory # You can overide these variables using /etc/sysconfig/deltacloud-core PIDFILE=${PIDFILE:-/var/run/$prog.pid} LOCKFILE=${LOCKFILE:-/var/lock/subsys/$prog} CONFFILE=${CONFFILE:-} OPTIONS=${OPTIONS:-} if [ -n "$CONFFILE" ]; then OPTIONS="--config $CONFFILE $OPTIONS" fi # LOGFILE=${LOGFILE:-/var/log/$prog.log} start() { [ -x $binary ] || exit 5 echo -n $"Starting $prog: " if [ $UID -ne 0 ]; then RETVAL=1 failure else daemon --pidfile=$PIDFILE $binary $OPTIONS RETVAL=$? [ $RETVAL -eq 0 ] && touch $LOCKFILE fi; echo return $RETVAL } stop() { echo -n $"Stopping $prog: " if [ $UID -ne 0 ]; then RETVAL=1 failure else killproc -p $PIDFILE $binary RETVAL=$? [ $RETVAL -eq 0 ] && rm -f $LOCKFILE fi; echo return $RETVAL } #reload(){ # echo -n $"Reloading $prog: " # killproc -p $PIDFILE $binary -HUP # RETVAL=$? # echo # return $RETVAL #} restart(){ stop start } condrestart(){ [ -e $LOCKFILE ] && restart return 0 } case "$1" in start) start RETVAL=$? ;; stop) stop RETVAL=$? ;; restart) restart RETVAL=$? ;; reload|force-reload) reload RETVAL=$? ;; condrestart|try-restart) condrestart RETVAL=$? ;; status) status imagefactory RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}" RETVAL=2 esac exit $RETVAL