]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/scripts/bacula.in
Fix scripts/bacula.in to have awk on an environment variable
[bacula/bacula] / bacula / scripts / bacula.in
index 0d7996703aed17eaf1375dc65b046cb2521b9ac8..b530ad8cf3b2af66b1c6937d922216b227ef7e40 100755 (executable)
 
 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.
@@ -131,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}"
@@ -153,7 +160,7 @@ status() {
        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`