e4rat optimization scripts added.
This commit is contained in:
parent
4e6fcf119b
commit
6ad162aaad
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
let timeout=0`grep --color=NO '^[ \t]*timeout' /etc/e4rat.conf | head -n1 | sed 's~[^0-9]\+\([0-9]\+\).*~\1~'`
|
||||||
|
|
||||||
|
sleep $timeout
|
||||||
|
|
||||||
|
e4rat-collect -k
|
||||||
|
pkill e4rat-collect
|
||||||
|
|
||||||
|
e4rat-realloc /var/lib/e4rat/startup.log
|
||||||
|
|
||||||
|
e4rat_switch.sh preload
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ `which e4rat-realloc 2>/dev/null` && `grep 'init=/sbin/e4rat-' /boot/grub/grub.conf` ]]; then
|
||||||
|
echo "e4rat package and e4rat init record in grub.conf found ;-)"
|
||||||
|
else
|
||||||
|
echo "Either e4rat package or e4rat record in grub.conf not found, exiting..."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
collect)
|
||||||
|
echo "Setting up e4rat for collecting data"
|
||||||
|
echo "remounting /boot -> rw"
|
||||||
|
mount -o remount,rw /boot && \
|
||||||
|
sed -i "s~init=/sbin/e4rat-[a-z]*~init=/sbin/e4rat-collect~g" \
|
||||||
|
/boot/grub/grub.conf && \
|
||||||
|
echo "remounting /boot -> ro" && \
|
||||||
|
mount -o remount,ro /boot && \
|
||||||
|
echo -e "#/bin/bash\n\n/usr/sbin/e4rat-finalize.sh && rm -f /etc/local.d/e4rat-finalize.start\n" \
|
||||||
|
> /etc/local.d/e4rat-finalize.start && \
|
||||||
|
chmod 755 /etc/local.d/e4rat-finalize.start
|
||||||
|
[ 0 -ne $? ] && echo "e4rat_switch.sh $1 failed" && exit -1
|
||||||
|
;;
|
||||||
|
preload)
|
||||||
|
echo "Setting up e4rat for preload system files"
|
||||||
|
echo "remounting /boot -> rw"
|
||||||
|
mount -o remount,rw /boot && \
|
||||||
|
sed -i "s~init=/sbin/e4rat-[a-z]*~init=/sbin/e4rat-preload~g" \
|
||||||
|
/boot/grub/grub.conf && \
|
||||||
|
echo "remounting /boot -> ro" && \
|
||||||
|
mount -o remount,ro /boot
|
||||||
|
[ 0 -ne $? ] && echo "e4rat_switch.sh $1 failed" && exit -1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: e4rat_switch.sh {collect|preload}"
|
||||||
|
exit -1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
|
@ -444,4 +444,11 @@ if [ 20 -eq $STAGE ]; then
|
||||||
let STAGE++
|
let STAGE++
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Stage 21: Enabling e4rat data collection
|
||||||
|
if [ 21 -eq $STAGE ]; then
|
||||||
|
echo "======= STAGE $STAGE: Enabling e4rat data collection ======="
|
||||||
|
e4rat_switch.sh collect
|
||||||
|
[ 0 -ne $? ] && echo "Stage $STAGE: Enabling e4rat data collection failed ;-( =======" && exit $STAGE
|
||||||
|
|
||||||
|
let STAGE++
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue