PSCMD="@PSCMD@"
-BACBIN=@sbindir@
-BACCFG=@sysconfdir@
+# All these are not *really* needed but it makes it
+# easier to "steal" this code for the development
+# environment where they are different.
+#
+BACFDBIN=@sbindir@
+BACFDCFG=@sysconfdir@
+BACSDBIN=@sbindir@
+BACSDCFG=@sysconfdir@
+BACDIRBIN=@sbindir@
+BACDIRCFG=@sysconfdir@
PIDDIR=@piddir@
SUBSYSDIR=@subsysdir@
-DIR_PORT=9101
-FD_PORT=9102
-SD_PORT=9103
+DIR_PORT=@dir_port@
+FD_PORT=@fd_port@
+SD_PORT=@sd_port@
DIR_USER=@dir_user@
DIR_GROUP=@dir_group@
case "$1" in
start)
- [ -x ${BACBIN}/bacula-sd ] && {
- echo "Starting the Storage daemon"
- OPTIONS=''
- if [ "${SD_USER}" != '' ]; then
- OPTIONS="${OPTIONS} -u ${SD_USER}"
- fi
-
- if [ "${SD_GROUP}" != '' ]; then
- OPTIONS="${OPTIONS} -g ${SD_GROUP}"
- fi
-
- ${BACBIN}/bacula-sd $2 ${OPTIONS} -v -c ${BACCFG}/bacula-sd.conf
+ [ -x ${BACSDBIN}/bacula-sd ] && {
+ echo "Starting the Storage daemon"
+ OPTIONS=''
+ if [ "${SD_USER}" != '' ]; then
+ OPTIONS="${OPTIONS} -u ${SD_USER}"
+ fi
+
+ if [ "${SD_GROUP}" != '' ]; then
+ OPTIONS="${OPTIONS} -g ${SD_GROUP}"
+ fi
+
+ ${BACSDBIN}/bacula-sd $2 ${OPTIONS} -v -c ${BACSDCFG}/bacula-sd.conf
}
- [ -x ${BACBIN}/bacula-fd ] && {
- echo "Starting the File daemon"
- OPTIONS=''
- if [ "${FD_USER}" != '' ]; then
- OPTIONS="${OPTIONS} -u ${FD_USER}"
- fi
+ [ -x ${BACFDBIN}/bacula-fd ] && {
+ echo "Starting the File daemon"
+ OPTIONS=''
+ if [ "${FD_USER}" != '' ]; then
+ OPTIONS="${OPTIONS} -u ${FD_USER}"
+ fi
- if [ "${FD_GROUP}" != '' ]; then
- OPTIONS="${OPTIONS} -g ${FD_GROUP}"
- fi
+ if [ "${FD_GROUP}" != '' ]; then
+ OPTIONS="${OPTIONS} -g ${FD_GROUP}"
+ fi
- ${BACBIN}/bacula-fd $2 ${OPTIONS} -v -c ${BACCFG}/bacula-fd.conf
+ ${BACFDBIN}/bacula-fd $2 ${OPTIONS} -v -c ${BACFDCFG}/bacula-fd.conf
}
- [ -x ${BACBIN}/bacula-dir ] && {
- sleep 2
- echo "Starting the Director daemon"
- OPTIONS=''
- if [ "${DIR_USER}" != '' ]; then
- OPTIONS="${OPTIONS} -u ${DIR_USER}"
- fi
+ [ -x ${BACDIRBIN}/bacula-dir ] && {
+ sleep 2
+ echo "Starting the Director daemon"
+ OPTIONS=''
+ if [ "${DIR_USER}" != '' ]; then
+ OPTIONS="${OPTIONS} -u ${DIR_USER}"
+ fi
- if [ "${DIR_GROUP}" != '' ]; then
- OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
- fi
+ if [ "${DIR_GROUP}" != '' ]; then
+ OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
+ fi
- ${BACBIN}/bacula-dir $2 ${OPTIONS} -v -c ${BACCFG}/bacula-dir.conf
+ ${BACDIRBIN}/bacula-dir $2 ${OPTIONS} -v -c ${BACDIRCFG}/bacula-dir.conf
}
;;
stop)
- [ -x ${BACBIN}/bacula-sd ] && {
- echo "Stopping the Storage daemon"
- killproc ${BACBIN}/bacula-sd ${SD_PORT}
+ # Stop the FD first so that SD will fail jobs and update catalog
+ [ -x ${BACFDBIN}/bacula-fd ] && {
+ echo "Stopping the File daemon"
+ killproc ${BACFDBIN}/bacula-fd ${FD_PORT}
}
- [ -x ${BACBIN}/bacula-fd ] && {
- echo "Stopping the File daemon"
- killproc ${BACBIN}/bacula-fd ${FD_PORT}
+ [ -x ${BACSDBIN}/bacula-sd ] && {
+ echo "Stopping the Storage daemon"
+ killproc ${BACSDBIN}/bacula-sd ${SD_PORT}
}
- [ -x ${BACBIN}/bacula-dir ] && {
- echo "Stopping the Director daemon"
- killproc ${BACBIN}/bacula-dir ${DIR_PORT}
+ [ -x ${BACDIRBIN}/bacula-dir ] && {
+ echo "Stopping the Director daemon"
+ killproc ${BACDIRBIN}/bacula-dir ${DIR_PORT}
}
echo
;;
;;
status)
- [ -x ${BACBIN}/bacula-sd ] && status ${BACBIN}/bacula-sd ${SD_PORT}
- [ -x ${BACBIN}/bacula-fd ] && status ${BACBIN}/bacula-fd ${FD_PORT}
- [ -x ${BACBIN}/bacula-dir ] && status ${BACBIN}/bacula-dir ${DIR_PORT}
+ [ -x ${BACSDBIN}/bacula-sd ] && status ${BACSDBIN}/bacula-sd ${SD_PORT}
+ [ -x ${BACFDBIN}/bacula-fd ] && status ${BACFDBIN}/bacula-fd ${FD_PORT}
+ [ -x ${BACDIRBIN}/bacula-dir ] && status ${BACDIRBIN}/bacula-dir ${DIR_PORT}
;;
*)