Skip to content

Commit

Permalink
dir startscript also checks the configuration
Browse files Browse the repository at this point in the history
Also added a debug message to the dummy libbareoscats library
  • Loading branch information
pstorz authored and Marco van Wieringen committed Mar 26, 2014
1 parent a555ede commit a686d2c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
7 changes: 6 additions & 1 deletion scripts/bareos-ctl-dir.in
Expand Up @@ -50,7 +50,7 @@ fi
case "$1" in
start)
[ -x ${BACDIRBIN}/bareos-dir ] && {
echo "Starting the $Bareos Director daemon"
echo "Starting the $Bareos Director daemon"
OPTIONS=''
if [ "${DIR_USER}" != '' ]; then
OPTIONS="${OPTIONS} -u ${DIR_USER}"
Expand All @@ -60,6 +60,11 @@ case "$1" in
OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
fi

checkcfg
if [ $? != 0 ]; then
exit 1
fi

if [ "x${VALGRIND_DIR}" = "x1" ]; then
valgrind --leak-check=full ${BACDIRBIN}/bareos-dir $2 $3 ${OPTIONS} -v -c ${BACDIRCFG}/bareos-dir.conf
else
Expand Down
15 changes: 15 additions & 0 deletions scripts/bareos-ctl-funcs
Expand Up @@ -108,6 +108,21 @@ killproc() {
return $RC
}

# Function that checks if the configuration is OK and the Database can be connected
checkcfg() {
echo "Checking Configuration and Database connection ... "
if [ ! -z "${DIR_USER}" ]; then
su -s /bin/sh ${DIR_USER} -c "${BACDIRBIN}/bareos-dir ${OPTIONS} -f -t -c ${BACDIRCFG}/bareos-dir.conf"
else
${BACDIRBIN}/bareos-dir ${OPTIONS} -f -t -c ${BACDIRCFG}/bareos-dir.conf
fi
if [ $? -eq 0 ]; then
return 0
else
return 1
fi
}

status() {
pid=""
# Test syntax.
Expand Down
2 changes: 1 addition & 1 deletion src/cats/cats_dummy.c
Expand Up @@ -40,7 +40,7 @@ B_DB *db_init_database(JCR *jcr,
bool need_private)
{
Jmsg(jcr, M_FATAL, 0, _("Please replace this dummy libbareoscats library with a proper one.\n"));

Dmsg0(0, _("Please replace this dummy libbareoscats library with a proper one.\n"));
return NULL;
}

Expand Down

0 comments on commit a686d2c

Please sign in to comment.