Hacked By AnonymousFox

Current Path : /usr/share/lve/service/
Upload File :
Current File : //usr/share/lve/service/lve-kmod.sh

#!/bin/bash
#
# lve-kmod      Bring up/down lve kernel interface
# description: load and unload lve module
#
if [ -f /etc/sysconfig/lve ]; then
	. /etc/sysconfig/lve
else
if [ -f /etc/default/lve ]; then
	. /etc/default/lve
else
	echo "default config don't found"
	exit 1
fi
fi

if [ -e /sys/fs/cgroup ]; then
    mount -o remount,rw /sys/fs/cgroup
    for item in freezer devices 'cpu,cpuacct' cpuset memory; do
        CGROUP_PATH="/sys/fs/cgroup/$item"
        if [ ! -d "$CGROUP_PATH" ]; then
            mkdir -p "$CGROUP_PATH"
        fi
        grep -q "$CGROUP_PATH" /proc/mounts
        if [ $? -ne 0 ]; then
            mount -t cgroup cgroup "$CGROUP_PATH" -o "$item"
        fi
    done
fi

# Check that lve is enabled.
[ "${LVE_ENABLE}" != "yes" ] && exit 0

KERNEL_UNAME=$(uname -r)

# See how we were called.
case "$1" in
  start)
        # loading LVE module
	modprobe kmodlve || { echo "LVE module is missing"; exit 1; }

        lvectl start
        for f in $(ls /etc/sysctl.d/*cloudlinux*.conf); do sysctl -p $f; done
        touch /var/lock/subsys/lve-kmod
        ;;
  stop)
        # unloading LVE module
        lvectl destroy all
        rmmod kmodlve || { echo "Cannot unload LVE module"; exit 1; }        
	rm -f /var/lock/subsys/lve-kmod
        ;;
  *)
        echo $"Usage: $0 {start|stop}"
        exit 1
esac

exit 0

Hacked By AnonymousFox1.0, Coded By AnonymousFox