net-acc 659 字节
Newer Older
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
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

function usage() {
	echo ""
	echo "Usage:"
	echo "    $0 [enable | disable]"
	echo ""
}

function mount_cgp2() {
	CGP2=`mount | grep cgroup2`
	if [[ "$CGP2"X == "X" ]]; then
		CGP2_PATCH=/sys/fs/cgroup/tunned-acc
		mount -o rw,remount  /sys/fs/cgroup
		mkdir -p ${CGP2_PATCH}
		mount -t cgroup2 -o nosuid,nodev,noexec none ${CGP2_PATCH}
		mount -o ro,remount  /sys/fs/cgroup
	fi
}

CMD=$1

if [[ "$CMD"X == "enableX" ]]; then
	mount_cgp2
	modprobe localip
	/usr/sbin/tuned_acc/redis_acc enable
elif [[ "$CMD"X == "disableX" ]]; then
	/usr/sbin/tuned_acc/redis_acc disable
	rmmod localip
	exit 0
else
	usage;
fi