From dd59afd339e0fb84ce6314805cfac7e4446d976f Mon Sep 17 00:00:00 2001 From: Simone Caronni Date: Jan 09 2013 11:55:32 +0000 Subject: Update SysV init scripts --- diff --git a/bacula-dir.init b/bacula-dir.init index d24bdb4..d13cd98 100644 --- a/bacula-dir.init +++ b/bacula-dir.init @@ -1,87 +1,116 @@ -#!/bin/bash +#!/bin/sh # -# bacula-dir This shell script takes care of starting and stopping -# the bacula-dir daemon, the backup director controling -# the backup jobs. +# bacula-dir Takes care of starting and stopping the Bacula Director. # # chkconfig: - 80 20 -# description: Bacula-dir is the Backup-server, which is the program \ -# that schedules backups and controls the bacula-client and \ -# the bacula-storage daemons. -# processname: bacula-dir -# config: /etc/bacula/bacula-dir.conf -# pidfile: /var/run/bacula-dir.9101.pid +# description: The Bacula Director is the daemon responsible for all the logic \ +# regarding the backup infrastructure: database, file retention, \ +# tape indexing, scheduling. -# Source function library. -. /etc/init.d/functions +### BEGIN INIT INFO +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Bacula Director Daemon. +# Description: The Bacula Director is the daemon responsible for all the logic +# regarding the backup infrastructure: database, file retention, +# tape indexing, scheduling. +### END INIT INFO -# Source configuration. -if [ -f /etc/sysconfig/bacula-dir ] ; then - . /etc/sysconfig/bacula-dir -fi +# Source function library. +. /etc/rc.d/init.d/functions -RETVAL=0 +exec="/usr/sbin/bacula-dir" prog="bacula-dir" CONFIG="/etc/bacula/bacula-dir.conf" OPTS="-c $CONFIG" +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +lockfile=/var/lock/subsys/$prog + if [ "$DIR_USER" != '' ]; then - OPTS="$OPTS -u $DIR_USER" + OPTS="$OPTS -u $DIR_USER" fi if [ "$DIR_GROUP" != '' ]; then - OPTS="$OPTS -g $DIR_GROUP" + OPTS="$OPTS -g $DIR_GROUP" fi start() { - [ "$EUID" != "0" ] && exit 4 - - echo -n "Starting $prog: " - bacula-checkconf $CONFIG - daemon $prog $OPTS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog - return $RETVAL -} + [ -x $exec ] || exit 5 + [ -f $config ] || exit 6 + echo -n $"Starting $prog: " + bacula-checkconf $CONFIG + daemon $prog $OPTS + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} stop() { - [ "$EUID" != "0" ] && exit 4 - - echo -n "Shutting down $prog: " - killproc $prog - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog - return $RETVAL + echo -n $"Stopping $prog: " + # stop it here, often "killproc $prog" + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + sleep 1 + start } +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + # run checks to determine if the service is running or use generic status + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + case "$1" in start) - start - ;; + rh_status_q && exit 0 + $1 + ;; stop) - stop - ;; + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; status) - status $prog - ;; - restart|force-reload) - stop - sleep 1 - start - ;; + rh_status + ;; condrestart|try-restart) - if [ -f /var/lock/subsys/$prog ]; then - stop - sleep 1 - start - fi - ;; + rh_status_q || exit 0 + restart + ;; *) - echo "Usage: $prog {start|stop|status|restart|force-reload|condrestart|try-restart}" - [ "$1" = "usage" ] && exit 0 - exit 2 - ;; + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 esac exit $? diff --git a/bacula-fd.init b/bacula-fd.init index 7300831..00b297e 100644 --- a/bacula-fd.init +++ b/bacula-fd.init @@ -1,87 +1,114 @@ -#!/bin/bash +#!/bin/sh # -# bacula-fd This shell script takes care of starting and stopping -# the bacula-fd daemon, the backup client enabling bacula -# to backup the local machine. +# bacula-fd Takes care of starting and stopping the Bacula File Daemon. # # chkconfig: - 80 20 -# description: Bacula-fd is a Backup-client, which is the program \ -# that enables the bacula-server to backup the local \ -# machine. -# processname: bacula-fd -# config: /etc/bacula/bacula-fd.conf -# pidfile: /var/run/bacula-fd.9102.pid +# description: The Bacula File Daemon is the daemon responsible for backing up \ +# data on the system. -# Source function library. -. /etc/init.d/functions +### BEGIN INIT INFO +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Bacula File Daemon. +# Description: The Bacula File Daemon is the daemon responsible for backing up +# data on the system. +### END INIT INFO -# Source configuration. -if [ -f /etc/sysconfig/bacula-fd ] ; then - . /etc/sysconfig/bacula-fd -fi +# Source function library. +. /etc/rc.d/init.d/functions -RETVAL=0 +exec="/usr/sbin/bacula-fd" prog="bacula-fd" CONFIG="/etc/bacula/bacula-fd.conf" OPTS="-c $CONFIG" +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +lockfile=/var/lock/subsys/$prog + if [ "$FD_USER" != '' ]; then - OPTS="$OPTS -u $FD_USER" + OPTS="$OPTS -u $FD_USER" fi if [ "$FD_GROUP" != '' ]; then - OPTS="$OPTS -g $FD_GROUP" + OPTS="$OPTS -g $FD_GROUP" fi start() { - [ "$EUID" != "0" ] && exit 4 - - echo -n "Starting $prog: " - bacula-checkconf $CONFIG - daemon $prog $OPTS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog - return $RETVAL -} + [ -x $exec ] || exit 5 + [ -f $config ] || exit 6 + echo -n $"Starting $prog: " + bacula-checkconf $CONFIG + daemon $prog $OPTS + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} stop() { - [ "$EUID" != "0" ] && exit 4 - - echo -n "Shutting down $prog: " - killproc $prog - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog - return $RETVAL + echo -n $"Stopping $prog: " + # stop it here, often "killproc $prog" + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + sleep 1 + start } +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + # run checks to determine if the service is running or use generic status + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + case "$1" in start) - start - ;; + rh_status_q && exit 0 + $1 + ;; stop) - stop - ;; + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; status) - status $prog - ;; - restart|force-reload) - stop - sleep 1 - start - ;; + rh_status + ;; condrestart|try-restart) - if [ -f /var/lock/subsys/$prog ]; then - stop - sleep 1 - start - fi - ;; + rh_status_q || exit 0 + restart + ;; *) - echo "Usage: $prog {start|stop|status|restart|force-reload|condrestart|try-restart}" - [ "$1" = "usage" ] && exit 0 - exit 2 - ;; + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 esac exit $? diff --git a/bacula-sd.init b/bacula-sd.init index 3d7157a..32f1773 100644 --- a/bacula-sd.init +++ b/bacula-sd.init @@ -1,86 +1,114 @@ -#!/bin/bash +#!/bin/sh # -# bacula-sd This shell script takes care of starting and stopping -# the bacula-sd daemon, the storage daemon responsible -# for accessing the backup storage device. +# bacula-sd Takes care of starting and stopping the Bacula Storage Daemon. # # chkconfig: - 80 20 -# description: Bacula-sd is the storage-server, which is the program \ -# that accesses the storage device. -# processname: bacula-sd -# config: /etc/bacula/bacula-sd.conf -# pidfile: /var/run/bacula-dir.9103.pid +# description: The Bacula Storage Daemon is the daemon responsible for saving \ +# backed up data on the various File Daemon to the appropriate \ +# storage devices. + +### BEGIN INIT INFO +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Bacula Storage Daemon. +# Description: The Bacula Storage Daemon is the daemon responsible for saving +# backed up data on the various File Daemon to the appropriate +# storage devices. +### END INIT INFO # Source function library. . /etc/init.d/functions -# Source configuration. -if [ -f /etc/sysconfig/bacula-sd ] ; then - . /etc/sysconfig/bacula-sd -fi - -RETVAL=0 +exec="/usr/sbin/bacula-sd" prog="bacula-sd" CONFIG="/etc/bacula/bacula-sd.conf" OPTS="-c $CONFIG" +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + if [ "$SD_USER" != '' ]; then - OPTS="$OPTS -u $SD_USER" + OPTS="$OPTS -u $SD_USER" fi if [ "$SD_GROUP" != '' ]; then - OPTS="$OPTS -g $SD_GROUP" + OPTS="$OPTS -g $SD_GROUP" fi start() { - [ "$EUID" != "0" ] && exit 4 - - echo -n "Starting $prog: " - bacula-checkconf $CONFIG - daemon $prog $OPTS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog - return $RETVAL -} + [ -x $exec ] || exit 5 + [ -f $config ] || exit 6 + echo -n $"Starting $prog: " + bacula-checkconf $CONFIG + daemon $prog $OPTS + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} stop() { - [ "$EUID" != "0" ] && exit 4 + echo -n $"Stopping $prog: " + # stop it here, often "killproc $prog" + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + sleep 2 + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + # run checks to determine if the service is running or use generic status + status $prog +} - echo -n "Shutting down $prog: " - killproc $prog - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog - return $RETVAL +rh_status_q() { + rh_status >/dev/null 2>&1 } + case "$1" in start) - start - ;; + rh_status_q && exit 0 + $1 + ;; stop) - stop - ;; + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; status) - status $prog - ;; - restart|force-reload) - stop - sleep 2 - start - ;; + rh_status + ;; condrestart|try-restart) - if [ -f /var/lock/subsys/$prog ]; then - stop - sleep 2 - start - fi - ;; + rh_status_q || exit 0 + restart + ;; *) - echo "Usage: $prog {start|stop|status|restart|force-reload|condrestart|try-restart}" - [ "$1" = "usage" ] && exit 0 - exit 2 - ;; + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 esac exit $? diff --git a/bacula.spec b/bacula.spec index e4ee5f1..e72592a 100644 --- a/bacula.spec +++ b/bacula.spec @@ -3,7 +3,7 @@ Name: bacula Version: 5.2.12 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Cross platform network backup for Linux, Unix, Mac and Windows # See LICENSE for details License: AGPLv3 with exceptions @@ -903,6 +903,10 @@ fi %changelog +* Wed Jan 09 2013 Simone Caronni - 5.2.12-4 +- Updated SysV init script according to Fedora template: + https://fedoraproject.org/wiki/Packaging:SysVInitScript + * Wed Oct 17 2012 Simone Caronni - 5.2.12-3 - Add sample-query.sql file to Director's docs.