Simple power scripts

Shardul SethShardul Seth wrote on 14 Jun 2012 16:04

Summary

These are simple scripts that I have made a widget to (multiple scripts widget), so that power options are easily at hand ;)

PS: All have to be run as root

Script

Reboot

#!/system/bin/sh
reboot

Reboot recovery

(xperia devices with custom kernel)

#!/system/bin/sh
echo "boot" >/cache/recovery/boot
reboot

Poweroff

#!/system/bin/sh
reboot -p

Superclean and reboot

(credits zeppelinrox @ xda-developers)

#!/system/bin/sh
#
# SuperClean & ReStart script (Wipe Dalvik Cache & Reboot) created by zeppelinrox.
#
line=================================================
clear
echo ""
echo $line
echo "  -=SuperClean & ReStart=- by -=zeppelinrox=-"
echo $line
echo ""
sleep 1
if [ ! "`id | grep =0`" ]; then
    sleep 2
    echo " You are NOT running this script as root..."
    echo ""
    sleep 3
    echo $line
    echo "                      ...No SuperUser for you!!"
    echo $line
    echo ""
    sleep 3
    echo "     ...Please Run as Root and try again..."
    echo ""
    echo $line
    echo ""
    sleep 3
    exit 69
fi
echo " Commencing SuperClean & ReStart!"
echo ""
sleep 2
for dv in /d*/dalvik-cache /c*/dalvik-cache; do rm -r /$dv/* 2>/dev/null; done
echo " All cleaned up and ready to..."
echo ""
sleep 2
echo $line
echo "                    !!POOF!!"
echo $line
echo ""
sleep 2
busybox sync
if [ -f "/proc/sys/kernel/sysrq" ]; then
    echo 1 > /proc/sys/kernel/sysrq 2>/dev/null
    echo b > /proc/sysrq-trigger 2>/dev/null
fi
echo "  If it don't go poofie, just reboot manually!"
echo ""
reboot; busybox reboot
echo "          ==========================="
echo "           ) SuperClean Completed! ("
echo "          ==========================="
echo ""
exit 0

Please feel free to add if you have more ;)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License