/usr/bin/cgm is in cgmanager-utils 0.24-0ubuntu5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | #!/bin/bash
# (C) Copyright Canonical Ltd. 2014
#
# Authors:
# Serge Hallyn <serge.hallyn@ubuntu.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
usage() {
me=`basename $1`
echo "Usage:"
echo " $me ping"
echo
echo " $me create <controller> cgroup"
echo
echo " $me chown <controller> <cgroup> uid gid"
echo
echo " $me chmod <controller> <cgroup> mode"
echo
echo " $me remove <controller> <cgroup>"
echo
echo " $me getpidcgroup <controller> pid"
echo
echo " $me movepid <controller> <cgroup> pid"
echo
echo " $me getvalue <controller> <cgroup> file"
echo
echo " $me setvalue <controller> <cgroup> file value"
echo
echo " $me gettasks <controller> <cgroup>"
echo
echo " $me listchildren <controller> <cgroup>"
echo
echo " $me removeonempty <controller> <cgroup>"
echo
echo " $me apiversion"
echo ""
echo " Replace '<controller>' with the desired controller, i.e."
echo " memory, and '<cgroup>' with the desired cgroup, i.e. x1."
echo " For create, chown, chmod, remove, and movepid, <controller>"
echo " may be \"all\"."
echo " To refer to the current cgroup, use ''."
exit 1
}
if [ $# -lt 1 ]; then
usage $0
fi
case "$1" in
--version)
echo 0.22
exit 0
;;
ping)
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Ping int32:0
exit $?
;;
getvalue)
if [ $# -lt 4 ]; then
usage $0
fi
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.GetValue string:$2 string:$3 string:$4
exit $?
;;
remove)
if [ $# -lt 3 ]; then
usage $0
fi
if [ "$2" = "all" ]; then
for cg in `awk '!/^#/ { print $1 }' /proc/cgroups`; do
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Remove string:$cg string:$3 int32:1
done
else
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Remove string:$2 string:$3 int32:1
fi
exit $?
;;
create)
if [ $# -lt 3 ]; then
usage $0
fi
if [ "$2" = "all" ]; then
for cg in `awk '!/^#/ { print $1 }' /proc/cgroups`; do
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Create string:$cg string:$3
done
else
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Create string:$2 string:$3
fi
exit $?
;;
chown)
if [ $# -lt 5 ]; then
usage $0
fi
if [ "$2" = "all" ]; then
for cg in `awk '!/^#/ { print $1 }' /proc/cgroups`; do
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Chown string:$cg string:$3 int32:$4 int32:$5
done
else
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Chown string:$2 string:$3 int32:$4 int32:$5
fi
exit $?
;;
chmod)
if [ $# -lt 4 ]; then
usage $0
fi
if [ "$2" = "all" ]; then
for cg in `awk '!/^#/ { print $1 }' /proc/cgroups`; do
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Chmod string:$cg string:$3 int32:$4
done
else
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Chmod string:$2 string:$3 int32:$4
fi
exit $?
;;
getpidcgroup)
if [ $# -lt 3 ]; then
usage $0
fi
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.GetPidCgroup string:$2 int32:$3
exit $?
;;
movepid)
if [ $# -lt 4 ]; then
usage $0
fi
if [ "$2" = "all" ]; then
for cg in `awk '!/^#/ { print $1 }' /proc/cgroups`; do
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.MovePid string:$cg string:$3 int32:$4
done
else
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.MovePid string:$2 string:$3 int32:$4
fi
exit $?
;;
setvalue)
if [ $# -lt 5 ]; then
usage $0
fi
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.SetValue string:$2 string:$3 string:$4 string:"$5"
exit $?
;;
gettasks)
if [ $# -lt 3 ]; then
usage $0
fi
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.GetTasks string:$2 string:$3
exit $?
;;
listchildren)
if [ $# -lt 3 ]; then
usage $0
fi
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.ListChildren string:$2 string:$3
exit $?
;;
removeonempty)
if [ $# -lt 3 ]; then
usage $0
fi
if [ "$2" = "all" ]; then
for cg in `awk '!/^#/ { print $1 }' /proc/cgroups`; do
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.RemoveOnEmpty string:$cg string:$3
done
else
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.RemoveOnEmpty string:$2 string:$3
fi
exit $?
;;
apiversion)
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock /org/linuxcontainers/cgmanager org.freedesktop.DBus.Properties.Get string:'org.linuxcontainers.cgmanager0_0' string:'api_version'
exit $?
;;
*)
usage $0
esac
|