#!/bin/bash

if [ -n "$UPSTART_SESSION" ] && ! systemctl --user --quiet is-active graphical-session.target; then
  if ! (initctl status bamfdaemon | grep -q start); then
    /sbin/initctl start bamfdaemon
  else
    echo "bamfdaemon job is already running..."
  fi
else
  /usr/local/libexec/bamf/bamfdaemon
fi
