View Single Post
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#80
This toggles between SD/eMMC:

Code:
#!/bin/sh
#swapswap
current_swap=$( cat /proc/swaps | awk '/mmcblk/ {print $1}' | cut -d "k" -f2 | cut -c1)
drivelist=$(sfdisk -lnd /dev/mmcblk1)
swapmicro=$(echo "$drivelist" -n | grep Id=82 | awk '/mmcblk1/ {print $1}')
 
if [ "$current_swap" = "0" ]; then
    if [ "$swapmicro" ]; then
        nice -20 swapon $swapmicro
        nice -20 swapoff /dev/mmcblk0p3    fi
#echo "swap is on sd"
elif [ "$current_swap" = "1" ]; then
    nice -20 swapon /dev/mmcblk0p3
    nice -20 swapoff $swapmicro
#echo "swap is on emmc"
fi
Run this at 4AM or whenever your n900 is out of action:
Code:
#!/bin/sh
#check if device is not in use, if so swapswap!
brightness=$(cat /sys/class/backlight/acx565akm/brightness)
keyboard=$(cat /sys/devices/platform/gpio-switch/slide/state)
 
if [ "$brightness" == "0" ]; then
    if [ "$keyboard" == "closed" ]; then
        echo "/opt/scripts/swapswap.sh" | root 
        echo "/opt/scripts/swapswap.sh" | root 
    fifi
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following 5 Users Say Thank You to vi_ For This Useful Post: