ablfs-more
trunk
Last change
on this file since 8e9343b was 8e9343b, checked in by Pierre Labastie <pierre.labastie@…>, 10 months ago |
Add forgotten run-with-cgroup.sh script
|
-
Property mode
set to
100755
|
File size:
529 bytes
|
Line | |
---|
1 | #!/bin/bash
|
---|
2 |
|
---|
3 | if [ -z "$CPUSPEC" ] || [ "$#" -lt 1 ]; then
|
---|
4 | echo "usage: CPUSPEC=... $0 command"
|
---|
5 | exit 1
|
---|
6 | fi
|
---|
7 |
|
---|
8 | set +e
|
---|
9 |
|
---|
10 | if type systemd-run >/dev/null 2>&1 ; then
|
---|
11 | sudo systemd-run -G --pty -d --uid=$(whoami) -p AllowedCPUs="$CPUSPEC" "$@"
|
---|
12 | else
|
---|
13 | sudo mkdir /sys/fs/cgroup/jhalfs
|
---|
14 | sudo sh -c "echo +cpuset > /sys/fs/cgroup/cgroup.subtree_control"
|
---|
15 | sudo sh -c "echo \"$CPUSPEC\" > /sys/fs/cgroup/jhalfs/cpuset.cpus"
|
---|
16 | (sudo sh -c "echo $BASHPID > /sys/fs/cgroup/jhalfs/cgroup.procs" &&
|
---|
17 | exec "$@")
|
---|
18 | sudo rmdir /sys/fs/cgroup/jhalfs
|
---|
19 | fi
|
---|
Note:
See
TracBrowser
for help on using the repository browser.