[bacula/f16] Update SysV init scripts
Simone Caronni
slaanesh at fedoraproject.org
Mon Sep 24 13:27:58 UTC 2012
commit 9a5b7dc36a143177fd5080086bd985ef714141f6
Author: Simone Caronni <negativo17 at gmail.com>
Date: Mon Sep 24 11:26:31 2012 +0200
Update SysV init scripts
bacula-dir.init | 45 +++------------------------------------------
bacula-fd.init | 6 +++---
bacula-sd.init | 45 +++------------------------------------------
3 files changed, 9 insertions(+), 87 deletions(-)
---
diff --git a/bacula-dir.init b/bacula-dir.init
index 02376ac..d24bdb4 100644
--- a/bacula-dir.init
+++ b/bacula-dir.init
@@ -33,50 +33,11 @@ if [ "$DIR_GROUP" != '' ]; then
OPTS="$OPTS -g $DIR_GROUP"
fi
-checkdatabase() {
- # First, get the currently selected database backend from the
- # alternatives system.
- DB=$(LANG=C alternatives --display bacula-dir | grep 'link currently points to' | awk -F. '{ print $2 }')
- case "$DB" in
- sqlite)
- # No check needed to see if the Database is running
- ;;
- mysql)
- # Check if mysqld is running
- service mysqld status > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo -n "Error: MySQL is not running"
- echo_failure
- echo
- exit 1
- fi
- ;;
- postgresql)
- # Check if postgresql is running
- service postgresql status > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo -n "Error: PostgreSQL is not running"
- echo_failure
- echo
- exit 1
- fi
- ;;
- *)
- echo -n "Error: Unknown database backend"
- echo_failure
- echo
- exit 1
- ;;
- esac
-}
-
start() {
[ "$EUID" != "0" ] && exit 4
echo -n "Starting $prog: "
bacula-checkconf $CONFIG
-# Removed for now, as the db might not be on localhost
-# checkdatabase
daemon $prog $OPTS
RETVAL=$?
echo
@@ -107,18 +68,18 @@ case "$1" in
;;
restart|force-reload)
stop
+ sleep 1
start
;;
- reload)
- ;;
condrestart|try-restart)
if [ -f /var/lock/subsys/$prog ]; then
stop
+ sleep 1
start
fi
;;
*)
- echo "Usage: $prog {start|stop|restart|condrestart|try-restart|reload|force-reload|status|usage}"
+ echo "Usage: $prog {start|stop|status|restart|force-reload|condrestart|try-restart}"
[ "$1" = "usage" ] && exit 0
exit 2
;;
diff --git a/bacula-fd.init b/bacula-fd.init
index 60f257f..7300831 100644
--- a/bacula-fd.init
+++ b/bacula-fd.init
@@ -68,18 +68,18 @@ case "$1" in
;;
restart|force-reload)
stop
+ sleep 1
start
;;
- reload)
- ;;
condrestart|try-restart)
if [ -f /var/lock/subsys/$prog ]; then
stop
+ sleep 1
start
fi
;;
*)
- echo "Usage: $prog {start|stop|restart|condrestart|try-restart|reload|force-reload|status|usage}"
+ echo "Usage: $prog {start|stop|status|restart|force-reload|condrestart|try-restart}"
[ "$1" = "usage" ] && exit 0
exit 2
;;
diff --git a/bacula-sd.init b/bacula-sd.init
index 6fb5e8d..3d7157a 100644
--- a/bacula-sd.init
+++ b/bacula-sd.init
@@ -32,50 +32,11 @@ if [ "$SD_GROUP" != '' ]; then
OPTS="$OPTS -g $SD_GROUP"
fi
-checkdatabase() {
- # First, get the currently selected database backend from the
- # alternatives system.
- DB=$(LANG=C alternatives --display bacula-sd | grep 'link currently points to' | awk -F. '{ print $2 }')
- case "$DB" in
- sqlite)
- # No check needed to see if the Database is running
- ;;
- mysql)
- # Check if mysqld is running
- service mysqld status > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo -n "Error: MySQL is not running"
- echo_failure
- echo
- exit 1
- fi
- ;;
- postgresql)
- # Check if postgresql is running
- service postgresql status > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo -n "Error: PostgreSQL is not running"
- echo_failure
- echo
- exit 1
- fi
- ;;
- *)
- echo -n "Error: Unknown database backend"
- echo_failure
- echo
- exit 1
- ;;
- esac
-}
-
start() {
[ "$EUID" != "0" ] && exit 4
echo -n "Starting $prog: "
bacula-checkconf $CONFIG
-# Disabled, the DB does not necessarily run on the same machine
-# checkdatabase
daemon $prog $OPTS
RETVAL=$?
echo
@@ -106,18 +67,18 @@ case "$1" in
;;
restart|force-reload)
stop
+ sleep 2
start
;;
- reload)
- ;;
condrestart|try-restart)
if [ -f /var/lock/subsys/$prog ]; then
stop
+ sleep 2
start
fi
;;
*)
- echo "Usage: $prog {start|stop|restart|condrestart|try-restart|reload|force-reload|status|usage}"
+ echo "Usage: $prog {start|stop|status|restart|force-reload|condrestart|try-restart}"
[ "$1" = "usage" ] && exit 0
exit 2
;;
More information about the scm-commits
mailing list