Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,734,299 Members 48,621 Now Online
XDA Developers Android and Mobile Development Forum

99swap doesnt run from init.d

Tip us?
 
saqibkhan
Old
(Last edited by saqibkhan; 16th April 2014 at 12:25 AM.)
#1  
saqibkhan's Avatar
Senior Member - OP
Thanks Meter 167
Posts: 474
Join Date: Sep 2012
Default 99swap doesnt run from init.d

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)
Phone: Xperia Play (R800i)
Android version : 4.4.4
Kernel version : Legacy Xperia 3.4
ROM : Legacy Xperia 4.4.4
Recovery: CWM


Kernel 3.x Development for Reference for all Dev's
Mike's Thread
Wedgess Thread
DooMLoRD Thread
 
saqibkhan
Old
#2  
saqibkhan's Avatar
Senior Member - OP
Thanks Meter 167
Posts: 474
Join Date: Sep 2012
BUMP
Phone: Xperia Play (R800i)
Android version : 4.4.4
Kernel version : Legacy Xperia 3.4
ROM : Legacy Xperia 4.4.4
Recovery: CWM


Kernel 3.x Development for Reference for all Dev's
Mike's Thread
Wedgess Thread
DooMLoRD Thread
 
ervinbolat
Old
#3  
Junior Member
Thanks Meter 0
Posts: 2
Join Date: May 2013
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.

Quote:
Originally Posted by saqibkhan View Post
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)
Tags
init.d etc 99swap swapon
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes