File: cgroupfs-umount

package info (click to toggle)
cgroupfs-mount 1.4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 80 kB
  • sloc: sh: 88; makefile: 2
file content (31 lines) | stat: -rwxr-xr-x 620 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
# Copyright 2011 Canonical, Inc
#           2014 Tianon Gravi
# Author: Serge Hallyn <serge.hallyn@canonical.com>
#         Tianon Gravi <tianon@debian.org>
set -e

# we don't care to move tasks around gratuitously - just umount the cgroups

# if we don't even have the directory we need, something else must be wrong
if [ ! -d /sys/fs/cgroup ]; then
	exit 0
fi

# if /sys/fs/cgroup is not mounted, we don't bother
if ! mountpoint -q /sys/fs/cgroup; then
	exit 0
fi

cd /sys/fs/cgroup

for sys in *; do
	if mountpoint -q $sys; then
		umount $sys
	fi
	if [ -d $sys ]; then
		rmdir $sys || true
	fi
done

exit 0