3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # bacula This shell script takes care of starting and stopping
7 # the bacula Director daemon
10 # description: The Leading Open Source Backup Solution.
12 # For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
15 # Source function library
16 . /etc/rc.d/init.d/functions
25 # if /lib/tls exists, force Bacula to use the glibc pthreads instead
26 if [ -d "/lib/tls" -a $OS = "Linux" -a `uname -r | cut -c1-3` = "2.4" ] ; then
27 export LD_ASSUME_KERNEL=2.4.19
30 # pull in any user defined DIR_DIR_OPTIONS, DIR_USER, DIR_GROUP or DAEMON_USER
31 [ -f /etc/sysconfig/bacula ] && . /etc/sysconfig/bacula
34 # Disable Glibc malloc checks, it doesn't help and it keeps from getting
42 if [ "${DIR_USER}" != '' ]; then
43 DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
46 if [ "${DIR_GROUP}" != '' ]; then
47 DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
50 if [ "${DAEMON_USER}" != '' -a "${DIR_USER}" != '' ]; then
52 if [ "${DIR_GROUP}" != '' ]; then
53 chown ${DIR_USER}:${DIR_GROUP} @working_dir@/bacula-dir* 2> /dev/null
55 chown ${DIR_USER} @working_dir@/bacula-dir* 2> /dev/null
57 DAEMON_OPTIONS="--user ${DIR_USER}"
59 echo -n "Starting Bacula Director services: "
60 daemon $DAEMON_OPTIONS @sbindir@/bacula-dir $2 ${DIR_OPTIONS} -c @sysconfdir@/bacula-dir.conf
63 [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-dir
66 echo -n "Stopping Bacula Director services: "
67 killproc @sbindir@/bacula-dir
70 [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-dir
79 status @sbindir@/bacula-dir
83 echo "Usage: $0 {start|stop|restart|status}"