X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fscripts%2Fbacula.in;h=b530ad8cf3b2af66b1c6937d922216b227ef7e40;hb=6b2b72889492bb7869eed7da56292e54ee67b3bc;hp=0ca89a1d68e46198455749d07786c3eddd4eade8;hpb=ae6036d20814ee3d72b46c83a75a27ae0b147e72;p=bacula%2Fbacula diff --git a/bacula/scripts/bacula.in b/bacula/scripts/bacula.in index 0ca89a1d68..b530ad8cf3 100755 --- a/bacula/scripts/bacula.in +++ b/bacula/scripts/bacula.in @@ -11,6 +11,12 @@ 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. @@ -35,6 +41,8 @@ FD_GROUP=@fd_group@ SD_USER=@sd_user@ SD_GROUP=@sd_group@ +PIDOF=@PIDOF@ + # A function to stop a program. killproc() { RC=0 @@ -112,7 +120,7 @@ pidofproc() { # 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 @@ -120,8 +128,8 @@ pidofproc() { 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 @@ -129,11 +137,12 @@ pidofproc() { 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}" @@ -144,14 +153,14 @@ status() { 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` @@ -163,7 +172,7 @@ status() { # 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 @@ -187,10 +196,17 @@ failure() { 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}" @@ -204,7 +220,7 @@ case "$1" in } [ -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}" @@ -219,7 +235,7 @@ case "$1" in [ -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}" @@ -236,17 +252,17 @@ case "$1" in 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