by doing
for file in /sys/devices/system/cpu/cpu*/online; do echo 0 > $file; done
we set the cpus offline. is there a script to do the hotplug work, detect cpu usage and above a % set cpus online and below a % usage set again cpu offline ? if there isn't any script already made, is there a way to detect current cpu usage only and "do" something if usage is above ...% ?
~EDITING my question:
i am currently here:
#!/bin/bash
while true
do
if (echo $[100-$(vmstat 1 2|tail -1|awk '{print $15}')] > 5) then
for file in /sys/devices/system/cpu/cpu*/online; do echo 1 > $file; done
fi
if (echo $[100-$(vmstat 1 2|tail -1|awk '{print $15}')] < 5) then
for file in /sys/devices/system/cpu/cpu*/online; do echo 0 > $file; done
fi
sleep 3
done
pfff it should work....
can you please correct me ?