Comment 6 for bug 11037

Revision history for this message
Michael K. Edwards (m-k-edwards) wrote :

cupsys.postinst should use pidof consistently instead of grepping ps output. It
should probably also sleep after kill -9. Here's a pseudo-patch (I'm not at a
debian/ubuntu box at the moment):

      # Check cupsys is really stopped... stupid
- if [ -n "`ps aux | grep /usr/sbin/cupsd | grep -v grep`" ]; then
+ if [ -n "`pidof /usr/sbin/cupsd`" ]; then
      echo "Hmm, cupsys won't stop... I wait 5 seconds..."
      sleep 5
- if [ -n "`ps aux | grep /usr/sbin/cupsd | grep -v grep`" ]; then
+ if [ -n "`pidof /usr/sbin/cupsd`" ]; then
         echo "Retrying to stop..."
        kill -9 `pidof /usr/sbin/cupsd` || true
+ sleep 5
      fi
  fi
- if [ -n "`ps aux | grep /usr/sbin/cupsd | grep -v grep`" ]; then
+ if [ -n "`pidof /usr/sbin/cupsd`" ]; then
      echo "Sorry, cupsys (or some forked processes) won't stop. Please stop
them manually."
      exit 1
  fi

Or it could use killall -clean cupsd. Either way, I actually think the
"processes won't stop test" is silly after a kill -9.