Upstart job's process getting killall-ed on reboot

Clint Byrum clint at ubuntu.com
Mon Apr 4 17:53:46 UTC 2011


Excerpts from James Hunt's message of Mon Apr 04 03:31:34 -0700 2011:
> Well, I think the main issue is really with the sysvinit package and the
> openvt job configuration file. It does beg the question though how a
> "pure" Upstart installation (in other words a system with no SysV legacy
> support) would/should handle shutdown cleanly. One option of course
> would be to create a shutdown.conf that stopped all jobs (ensuring it
> stopped itself last of course :-)

I think a pure upstart system still would have an event like 'runlevel 6'
where a user wants a reboot, and 'runlevel 0' where the user wants the box
to halt. The only difference is, I think they'd call these 'reboot' and
'halt', and there'd be a shutdown-process job that defined the order.
Things that want to insert themselves in this would simply start on
starting/stopped any of these tasks.

start on poweroff or halt or reboot
task
emits shutdown

console output

pre-start script
  if [ -z "$UPSTART_EVENTS" ] ; then
    stop ; exit 1
  fi
end script

script
  initctl emit shutdown
  start unmount-network-filesystems
  start disable-networking
  start stop-all-processes
  start unmount-filesystems

  case $UPSTART_EVENTS in
  poweroff)
    # do poweroff command
    ;;
  reboot)
    # do reboot command
    ;;
  halt)
    # do halt command 
    ;;
  esac
end script
#EOF

Then most jobs would 

stop on shutdown

And a few tasks would be

start on shutdown

or

start on starting disable-networking

This is basically how I see it working for a sysvinit shutdown as
well, we just need to run all of the normal sysvinit shutdown stuff on
shutdown. Sysvinit jobs that are "special" and want to stop later or
earlier will need special care no matter how its done.



More information about the upstart-devel mailing list