99swap doesnt run from init.d

Search This thread

saqibkhan

Senior Member
I am on MIUI ICS v4.

I have 99swap in system/etc/init.d

I have the .swapfile in /scdard/.swapfile

..the problem is.. I have to manualy activate Swapfile everytime I reboot.. why is the script not working.. when I was on MIUI v5 by maxworks as well same like v4.. it used to work correct..

I have given the system.. the etc.. and init.d folder all access. Read.Write.Execute


Below is MIUI v5 Script that used to work when I used that ROM.

#!/system/bin/sh
#Created by neamv for maxworks. All rights reserved
filename=/sdcard/.swapfile
fsize=256
recreate_on_boot=1
#sleep=120
timeout=240
while [ -z "`mount | grep "sdcard0 "`" ]; do
[ $timeout -lt 0 ] && exit 0
timeout=$(($timeout-10))
sleep 10
done
[ -n "`mount | grep "sdcard .*ntfs"`" ] && exit 0
if [ "$recreate_on_boot" == 1 ]; then
dd if=/dev/zero of=$filename"_new" bs=1024 count=$(($fsize*1024)) && mkswap $filename"_new" && mv $filename"_new" $filename
else
[ -f $filename ] && [ `stat -t $filename | awk '{print ($2)}'` -ne $(($fsize*1024*1024)) ] && rm $filename
[ ! -f $filename ] && dd if=/dev/zero of=$filename bs=1024 count=$(($fsize*1024)) && mkswap $filename
fi
swapon $filename



and below now is v4 script that doesn't work

#!/sbin/sh
#Created by neamv for maxworks. All rights reserved
filename=/sdcard/.swapfile
fsize=256
recreate_on_boot=1
timeout=240
while [ -z "`mount | grep "sdcard "`" ]; do
[ $timeout -lt 0 ] && exit 0
timeout=$(($timeout-10))
sleep 10
done
[ -n "`mount | grep "sdcard .*ntfs"`" ] && exit 0
if [ "$recreate_on_boot" == 1 ]; then
dd if=/dev/zero of=$filename"_new" bs=1024 count=$(($fsize*1024)) && mkswap $filename"_new" && mv $filename"_new" $filename
else
[ -f $filename ] && [ `stat -t $filename | awk '{print ($2)}'` -ne $(($fsize*1024*1024)) ] && rm $filename
[ ! -f $filename ] && dd if=/dev/zero of=$filename bs=1024 count=$(($fsize*1024)) && mkswap $filename
fi
swapon $filename






I didn't want to mess my phone.. so I thougt to ask. Plz automate the process of the Swapfile getting loaded after reboot.. it actually should be created on every boot at a different place in the SD-Card.. this is what I read from Maxworks.

Edit.. One more Question.. If I can.. to make my phone fun faster.. how large should I create the .swapfile.. lets say.. 512MB ?? 1 gb ?? and how to set the swappines.. (and no.. I don't want to use Swapper2)
 
Last edited:

ervinbolat

New member
May 10, 2013
2
0
Well, it should work, but may be caused by extensive brake swap. Try chaging the swap size
You can edit the file / system/etc/init.d/99swap replacing in fsize 256 to 64 for example.

I am on MIUI ICS v4.

I have 99swap in system/etc/init.d

I have the .swapfile in /scdard/.swapfile

..the problem is.. I have to manualy activate Swapfile everytime I reboot.. why is the script not working.. when I was on MIUI v5 by maxworks as well same like v4.. it used to work correct..

I have given the system.. the etc.. and init.d folder all access. Read.Write.Execute


Below is MIUI v5 Script that used to work when I used that ROM.

#!/system/bin/sh
#Created by neamv for maxworks. All rights reserved
filename=/sdcard/.swapfile
fsize=256
recreate_on_boot=1
#sleep=120
timeout=240
while [ -z "`mount | grep "sdcard0 "`" ]; do
[ $timeout -lt 0 ] && exit 0
timeout=$(($timeout-10))
sleep 10
done
[ -n "`mount | grep "sdcard .*ntfs"`" ] && exit 0
if [ "$recreate_on_boot" == 1 ]; then
dd if=/dev/zero of=$filename"_new" bs=1024 count=$(($fsize*1024)) && mkswap $filename"_new" && mv $filename"_new" $filename
else
[ -f $filename ] && [ `stat -t $filename | awk '{print ($2)}'` -ne $(($fsize*1024*1024)) ] && rm $filename
[ ! -f $filename ] && dd if=/dev/zero of=$filename bs=1024 count=$(($fsize*1024)) && mkswap $filename
fi
swapon $filename



and below now is v4 script that doesn't work

#!/sbin/sh
#Created by neamv for maxworks. All rights reserved
filename=/sdcard/.swapfile
fsize=256
recreate_on_boot=1
timeout=240
while [ -z "`mount | grep "sdcard "`" ]; do
[ $timeout -lt 0 ] && exit 0
timeout=$(($timeout-10))
sleep 10
done
[ -n "`mount | grep "sdcard .*ntfs"`" ] && exit 0
if [ "$recreate_on_boot" == 1 ]; then
dd if=/dev/zero of=$filename"_new" bs=1024 count=$(($fsize*1024)) && mkswap $filename"_new" && mv $filename"_new" $filename
else
[ -f $filename ] && [ `stat -t $filename | awk '{print ($2)}'` -ne $(($fsize*1024*1024)) ] && rm $filename
[ ! -f $filename ] && dd if=/dev/zero of=$filename bs=1024 count=$(($fsize*1024)) && mkswap $filename
fi
swapon $filename






I didn't want to mess my phone.. so I thougt to ask. Plz automate the process of the Swapfile getting loaded after reboot.. it actually should be created on every boot at a different place in the SD-Card.. this is what I read from Maxworks.

Edit.. One more Question.. If I can.. to make my phone fun faster.. how large should I create the .swapfile.. lets say.. 512MB ?? 1 gb ?? and how to set the swappines.. (and no.. I don't want to use Swapper2)