You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
620 B

  1. #!/bin/sh
  2. # Copyright 2011 Canonical, Inc
  3. # 2014 Tianon Gravi
  4. # Author: Serge Hallyn <serge.hallyn@canonical.com>
  5. # Tianon Gravi <tianon@debian.org>
  6. set -e
  7. # we don't care to move tasks around gratuitously - just umount the cgroups
  8. # if we don't even have the directory we need, something else must be wrong
  9. if [ ! -d /sys/fs/cgroup ]; then
  10. exit 0
  11. fi
  12. # if /sys/fs/cgroup is not mounted, we don't bother
  13. if ! mountpoint -q /sys/fs/cgroup; then
  14. exit 0
  15. fi
  16. cd /sys/fs/cgroup
  17. for sys in *; do
  18. if mountpoint -q $sys; then
  19. umount $sys
  20. fi
  21. if [ -d $sys ]; then
  22. rmdir $sys || true
  23. fi
  24. done
  25. exit 0