Browse Source

more/better/safer logic in our main scripts (which is the whole idea of this package)

tags/1.0
Tianon Gravi 7 years ago
parent
commit
3fd3dbc72b
2 changed files with 13 additions and 1 deletions
  1. +5
    -0
      cgroupfs-mount
  2. +8
    -1
      cgroupfs-umount

+ 5
- 0
cgroupfs-mount View File

@@ -19,6 +19,11 @@ if [ ! -e /proc/cgroups ]; then
exit 0
fi

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

# mount /sys/fs/cgroup if not already done
if ! mountpoint -q /sys/fs/cgroup; then
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup


+ 8
- 1
cgroupfs-umount View File

@@ -7,8 +7,15 @@ 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
mountpoint -q /sys/fs/cgroup || exit 0
if ! mountpoint -q /sys/fs/cgroup; then
exit 0
fi

cd /sys/fs/cgroup



Loading…
Cancel
Save