Sophie

Sophie

distrib > Mageia > 1 > x86_64 > by-pkgid > beddb7ab9e7b46abdaf09008ec43e917 > files > 8

bacula-sd-5.0.3-2.1.mga1.x86_64.rpm

#! /bin/sh
#
# bacula       This shell script takes care of starting and stopping
#	       the bacula Storage daemon.
#
# chkconfig: 2345 90 9
# description: It comes by night and sucks the vital essence from your computers.
#
#  For Bacula release 5.0.3 (13 December 2010) -- mageia
#
### BEGIN INIT INFO
# Provides:			bacula-sd
# Required-Start:		$local_fs $network
# Required-Stop:		$local_fs $network
# Default-Start:		3 5
# Default-Stop: 	0 1 2 6
# Short-Description:	bacula storage daemon
# Description:			Bacula network backup system storage daemon
### END INIT INFO

# Source function library
. /etc/rc.d/init.d/functions

SD_USER=bacula
SD_GROUP=tape
SD_OPTIONS=''

# pull in any user defined SD_OPTIONS, SD_USER, or SD_GROUP
[ -f /etc/sysconfig/bacula ] && . /etc/sysconfig/bacula

SD_PORT=`grep -i '^[[:space:]]*SDPort' /etc/bacula/bacula-sd.conf |sed -e 's/^.*=[[:space:]]*\([0-9]*\).*$/\1/'`
PIDFILE=/var/run/bacula-sd.${SD_PORT:-9103}.pid
OLDPIDFILE=/var/run/bacula-sd.pid

case "$1" in
    start)
	if [ "${SD_USER}" != '' ]; then
		SD_OPTIONS="${SD_OPTIONS} -u ${SD_USER}"
	fi
	if [ "${SD_GROUP}" != '' ]; then
		SD_OPTIONS="${SD_OPTIONS} -g ${SD_GROUP}"
	fi

	gprintf "Starting the Bacula Storage daemon: "
	daemon --pidfile=$PIDFILE /usr/sbin/bacula-sd $SD_OPTIONS -c /etc/bacula/bacula-sd.conf
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/bacula-sd
	;;
    stop)
	gprintf "Stopping the Bacula Storage daemon: "
	[ -e $OLDPIDFILE ] && killproc -p $OLDPIDFILE /usr/sbin/bacula-sd
	killproc -p $PIDFILE /usr/sbin/bacula-sd
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bacula-sd
	;;
    restart)
	$0 stop
	sleep 5
	$0 start
	;;
    condrestart)
    	[ -f /var/lock/subsys/bacula-sd ] && $0 restart
	;;
    status)
	status -p $PIDFILE /usr/sbin/bacula-sd
	;;
    *)
	gprintf "Usage: %s {start|stop|restart|status}\n" "$0"
	exit 1
	;;
esac