github.com/bshelton229/agent@v3.5.4+incompatible/scripts/check-upstart-conf.sh (about)

     1  #!/bin/bash
     2  
     3  set -o errexit
     4  set -o nounset
     5  
     6  if [[ ${#} -ne 1 ]]
     7  then
     8    echo "Usage: ${0} upstart-conf-file" >&2
     9    exit 1
    10  fi
    11  config=${1} && shift
    12  
    13  dbus_pid_file=$(/bin/mktemp)
    14  exec 4<> ${dbus_pid_file}
    15  
    16  dbus_add_file=$(/bin/mktemp)
    17  exec 6<> ${dbus_add_file}
    18  
    19  /bin/dbus-daemon --fork --print-pid 4 --print-address 6 --session
    20  
    21  function clean {
    22    kill $(cat ${dbus_pid_file})
    23    rm -f ${dbus_pid_file} ${dbus_add_file}
    24    exit 1
    25  }
    26  trap "{ clean; }" EXIT
    27  
    28  export DBUS_SESSION_BUS_ADDRESS=$(cat ${dbus_add_file})
    29  
    30  /bin/init-checkconf ${config}