← Back to team overview

touch-packages team mailing list archive

[Bug 1337407] Re: Upstart can NOT handle service/job started by others

 

** Tags removed: severity-high
** Tags added: severity-medium

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to upstart in Ubuntu.
https://bugs.launchpad.net/bugs/1337407

Title:
  Upstart can NOT handle service/job started by others

Status in “upstart” package in Ubuntu:
  New

Bug description:
  -- Problem Description --
  Upstart can not see a service/job/process that has been started and running by someone else. Old style init.d/systemd fully/partially handle start/stop correctly (on other Linux systems without Upstart), no matter who started the process.

  Our PMLinux collecting agent "daemon_PMLnx" was designed to start/run
  by root with any means, such as crontab, inittab, service, or even
  command line at a terminal. The program itself will quit immediately
  at the beginning if finds the process already running.

  Generally, we prefer to organize PMLinux as a service, plus create a
  start hook in the crontab to run "daemon_PMLnx" at 3am every day, in
  order to guarantee a restart won't be forgot if someone ever stopped
  the job.

  Here are some command outputs from Ubuntu/Upstart:

  # uname -a
  Linux ubuntu 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:09:21 UTC 2014 ppc64le ppc64le ppc64le GNU/Linux

  # dpkg -l upstart
  Name         Version          Architecture  Description
  -===========-================-=============-========================
  ii  upstart  1.12.1-0ubuntu4  ppc64el       event-based init daemon

  # ps -ef | grep -e PMLnx$ -e CRON$
  root     10263   771  0 17:59 ?        00:00:00 CRON
  root     10264 10263  0 17:59 ?        00:00:00 /bin/sh -c /var/perf/pm/bin/daemon_PMLnx (bug!)  
  root     10265 10264  0 17:59 ?        00:00:00 /var/perf/pm/bin/daemon_PMLnx

  # start PMLinux
  PMLinux stop/waiting           <--- bad!

  # status PMLinux
  PMLinux stop/waiting           <--- bad!

  # stop PMLinux
  stop: Unknown instance:           <--- bad!

  # kill -2 10265

  # start PMLinux
  PMLinux start/running, process 10562

  # ps -ef | grep -e PMLnx$
  root     10562     1  0 19:49 ?        00:00:00 /var/perf/pm/bin/daemon_PMLnx

  # start PMLinux
  start: Job is already running: PMLinux

  # stop PMLinux
  PMLinux stop/waiting

  # stop PMLinux
  stop: Unknown instance:

  # cat /etc/init/PMLinux.conf
  # daemon_PMLnx - Collecting Agent of IBM Performance Management for Power Linux (PMLinux)
  #
  # daemon_PMLnx collects PMLinux data at periodic scheduled times
  # working HOME directory - /var/perf/pm

  description     "IBM PMLinux collecting daemon"
  author "IBM PMLinux Team, Rochester, USA"

  start on runlevel [2345]
  stop on runlevel [!2345]

  # console output                                                                        # not works as expected: output to the working terminal (instead of system console)
  pre-start script
          unset myErrMSG
          if [ ! -x /var/perf/pm/bin/daemon_PMLnx ]; then
                  export myErrMSG='Daemon programs disappeared; please re-install ibmPMLinux'
  #       elif ps -C daemon_PMLnx >/dev/null; then
  #               export myErrMSG='PMLinux collecting daemon is already running!'
          elif [ ! -L /var/adm/perfmgr ] || [ ! -d /var/adm/perfmgr ]; then
                  export myErrMSG='PMLinux was NOT enabled; Please run "config.PMLnx" to activate'
          fi
          if [ -n "$myErrMSG" ]; then
                  echo -n "`date +'%D %T'` ";                      stop;
                  echo    "`date +'%D %T'` $myErrMSG"; exit 0
          fi
  end script

  post-start script
          if ps -C daemon_PMLnx >/dev/null; then
                  echo "`date +'%D %T'` PMLinux collecting daemon running..."
          else
                  echo "`date +'%D %T'` FAILED: Could NOT start PMLinux collecting daemon!!!"
          fi
  end script

  post-stop script
          echo "`date +'%D %T'` PMLinux collecting daemon stopped."
  end script

  exec /var/perf/pm/bin/daemon_PMLnx

  The attachment is a screenshot to demonstrate an old init under a
  different distro 1 that can find/stop PMLinux daemon started from user
  terminal.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/1337407/+subscriptions