SysV init scripts cleanup
This commit is contained in:
parent
fce586bc28
commit
70dfbe2845
@ -33,50 +33,11 @@ if [ "$DIR_GROUP" != '' ]; then
|
|||||||
OPTS="$OPTS -g $DIR_GROUP"
|
OPTS="$OPTS -g $DIR_GROUP"
|
||||||
fi
|
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() {
|
start() {
|
||||||
[ "$EUID" != "0" ] && exit 4
|
[ "$EUID" != "0" ] && exit 4
|
||||||
|
|
||||||
echo -n "Starting $prog: "
|
echo -n "Starting $prog: "
|
||||||
bacula-checkconf $CONFIG
|
bacula-checkconf $CONFIG
|
||||||
# Removed for now, as the db might not be on localhost
|
|
||||||
# checkdatabase
|
|
||||||
daemon $prog $OPTS
|
daemon $prog $OPTS
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
|
@ -32,50 +32,11 @@ if [ "$SD_GROUP" != '' ]; then
|
|||||||
OPTS="$OPTS -g $SD_GROUP"
|
OPTS="$OPTS -g $SD_GROUP"
|
||||||
fi
|
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() {
|
start() {
|
||||||
[ "$EUID" != "0" ] && exit 4
|
[ "$EUID" != "0" ] && exit 4
|
||||||
|
|
||||||
echo -n "Starting $prog: "
|
echo -n "Starting $prog: "
|
||||||
bacula-checkconf $CONFIG
|
bacula-checkconf $CONFIG
|
||||||
# Disabled, the DB does not necessarily run on the same machine
|
|
||||||
# checkdatabase
|
|
||||||
daemon $prog $OPTS
|
daemon $prog $OPTS
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
|
Loading…
Reference in New Issue
Block a user