PSCMD="@PSCMD@"
+#
+# On Solaris, you may need to use nawk, or alternatively,
+# add the GNU binaries to your path, such as /usr/xpg4/bin
+#
+AWK=awk
+
# All these are not *really* needed but it makes it
# easier to "steal" this code for the development
# environment where they are different.
SD_USER=@sd_user@
SD_GROUP=@sd_group@
+PIDOF=@PIDOF@
+
# A function to stop a program.
killproc() {
RC=0
# First try PID file
if [ -f ${PIDDIR}/$base.$2.pid ] ; then
- pid=`head -1 ${PIDDIR}/$base.$2.pid`
+ pid=`head -n 1 ${PIDDIR}/$base.$2.pid`
if [ "$pid" != "" ] ; then
echo $pid
return 0
fi
# Next try "pidof"
- if [ -x /sbin/pidof ] ; then
- pid=`/sbin/pidof $1`
+ if [ -x ${PIDOF} ] ; then
+ pid=`${PIDOF} $1`
fi
if [ "$pid" != "" ] ; then
echo $pid
fi
# Finally try to extract it from ps
- ${PSCMD} | grep $1 | awk '{ print $1 }' | tr '\n' ' '
+ ${PSCMD} | grep $1 | ${AWK} '{ print $1 }' | tr '\n' ' '
return 0
}
status() {
+ pid=""
# Test syntax.
if [ $# = 0 ] ; then
echo "Usage: status {program}"
base=`basename $1`
# First try "pidof"
- if [ -x /sbin/pidof ] ; then
- pid=`/sbin/pidof $1`
+ if [ -x ${PIDOF} ] ; then
+ pid=`${PIDOF} $1`
fi
if [ "$pid" != "" ] ; then
echo "$base (pid $pid) is running..."
return 0
else
- pid=`${PSCMD} | awk 'BEGIN { prog=ARGV[1]; ARGC=1 }
+ pid=`${PSCMD} | ${AWK} 'BEGIN { prog=ARGV[1]; ARGC=1 }
{ if ((prog == $2) || (("(" prog ")") == $2) ||
(("[" prog "]") == $2) ||
((prog ":") == $2)) { print $1 ; exit 0 } }' $1`
# Next try the PID files
if [ -f ${PIDDIR}/$base.$2.pid ] ; then
- pid=`head -1 ${PIDDIR}/$base.$2.pid`
+ pid=`head -n 1 ${PIDDIR}/$base.$2.pid`
if [ "$pid" != "" ] ; then
echo "$base dead but pid file exists"
return 1
return $rc
}
+OS=`uname -s`
+
+# if /lib/tls exists, force Bacula to use the glibc pthreads instead
+if [ -d "/lib/tls" -a $OS = "Linux" ] ; then
+ export LD_ASSUME_KERNEL=2.4.19
+fi
+
case "$1" in
start)
[ -x ${BACSDBIN}/bacula-sd ] && {
- echo "Starting the Storage daemon"
+ echo "Starting the Bacula Storage daemon"
OPTIONS=''
if [ "${SD_USER}" != '' ]; then
OPTIONS="${OPTIONS} -u ${SD_USER}"
}
[ -x ${BACFDBIN}/bacula-fd ] && {
- echo "Starting the File daemon"
+ echo "Starting the Bacula File daemon"
OPTIONS=''
if [ "${FD_USER}" != '' ]; then
OPTIONS="${OPTIONS} -u ${FD_USER}"
[ -x ${BACDIRBIN}/bacula-dir ] && {
sleep 2
- echo "Starting the Director daemon"
+ echo "Starting the Bacula Director daemon"
OPTIONS=''
if [ "${DIR_USER}" != '' ]; then
OPTIONS="${OPTIONS} -u ${DIR_USER}"
stop)
# Stop the FD first so that SD will fail jobs and update catalog
[ -x ${BACFDBIN}/bacula-fd ] && {
- echo "Stopping the File daemon"
+ echo "Stopping the Bacula File daemon"
killproc ${BACFDBIN}/bacula-fd ${FD_PORT}
}
[ -x ${BACSDBIN}/bacula-sd ] && {
- echo "Stopping the Storage daemon"
+ echo "Stopping the Bacula Storage daemon"
killproc ${BACSDBIN}/bacula-sd ${SD_PORT}
}
[ -x ${BACDIRBIN}/bacula-dir ] && {
- echo "Stopping the Director daemon"
+ echo "Stopping the Bacula Director daemon"
killproc ${BACDIRBIN}/bacula-dir ${DIR_PORT}
}
echo