[For DEV][Build.prop Tweak's]All tweaks - Samsung Galaxy SL i9003

Tweaks Increase download/upload/3G speeds
Code:
ro.ril.hsxpa=2
ro.ril.gprsclass=10
ro.ril.hep=1
ro.ril.enable.dtm=0
ro.ril.hsdpa.category=8 (or 10,12,14) Still looking for more of these though.
ro.ril.enable.a53=1
ro.ril.enable.3g.prefix=1
ro.ril.htcmaskw1.bitmask=4294967295
ro.ril.htcmaskw1=14449
ro.ril.hsupa.category=6
net.tcp.buffersize.default=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,16384,256960
Power Save Tweak
Code:
Allows the phone to sleep better
ro.ril.disable.power.collapse=0
Saves power when phone is sleep
pm.sleep_mode=1
Allows your wifi to scan less, saving more battery
wifi.supplicant_scan_interval=150 or 180 (your choice)
Helps Scrolling Responsiveness
windowsmgr.max_events_per_sec=150
Increase overal touch responsivenss
debug.performance.tuning=1
video.accelerate.hw=1
MEDIA TWEAKS
Code:
Makes streaming videos stream faster
media.stagefright.enable-player=true
media.stagefright.enable-meta=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=true
media.stagefright.enable-record=false
Increases quality of photo and videos
ro.media.dec.jpeg.memcap=8000000
ro.media.enc.hprof.vid.bps=8000000
Raises quality of JPEG images
ro.media.enc.jpeg.quality=90 or 100 (your choice)
BOOT TWEAKS
Code:
Gives your phone no boot animation
debug.sf.nobootanimation=1
SYSTEM TWEAKS
Code:
Forces your home launcher into memory
ro.HOME_APP_ADJ=1
Change the Dalvik VM heap size
dalvik.vm.heapsize=64m #or 48mb
To disable usb debugging popup
persist.adb.notify=0
To stop the phone from waking up when pressing the volume key
ro.config.hwfeature_wakeupkey=0
To make the phone ring faster when dialing out
ro.telephony.call_ring.delay=800
Disable black screen issue after call
ro.lge.proximity.delay=25
mot.proximity.delay=25
dalvik.vm.startheapsize = 4м
Screen ppi or font density
[B]ro.sf.lcd_density=240
Other Tweaks
Code:
mot.proximity.delay=150
debug.sf.hw=1 #Render UI with GPU
ro.kernel.android.checkjni=0
persist.sys.purgeable_assets=1

download link ? does it work in miui ?

anna0811 said:
download link ? does it work in miui ?
Click to expand...
Click to collapse
You add it to build.prop on your own.
Cheers
Sent from my GT-i9003 powered by MIUI

anna0811 said:
download link ? does it work in miui ?
Click to expand...
Click to collapse
read it it is for dev only

I am using must of them so no need to change it.Thanks Frank for collecting.

tarunagg said:
read it it is for dev only
Click to expand...
Click to collapse
i know it is for devs but i want to try it if there is a download link
btw can you tell me how to flash it

anna0811 said:
i know it is for devs but i want to try it if there is a download link
btw can you tell me how to flash it
Click to expand...
Click to collapse
all hail the king of troll
it has to be changed manually.not a flashable file.

anna0811 said:
i know it is for devs but i want to try it if there is a download link
btw can you tell me how to flash it
Click to expand...
Click to collapse
If you don't know how to apply them just install a rom that surely has some of them

Nice list.
I think ro.ril.disable.power.collapse should read
Code:
ro.ril.disable.power.collapse=0
because you want the power collapse to happen to save energy. Also, all commands should be lower case. Therefore it should be
Code:
debug.performance.tuning=1
video.accelerate.hw=1
with 'd' and 'v' instead of 'D' and 'V' at the beginning.
Further, I use
Code:
dalvik.vm.startheapsize=4m
which in my experience reduces RAM usage by approx. 15 MB on startup.

XDA_Bam said:
Nice list.
I think ro.ril.disable.power.collapse should read
Code:
ro.ril.disable.power.collapse=0
because you want the power collapse to happen to save energy. Also, all commands should be lower case. Therefore it should be
Code:
debug.performance.tuning=1
video.accelerate.hw=1
with 'd' and 'v' instead of 'D' and 'V' at the beginning.
Further, I use
Code:
dalvik.vm.startheapsize=4m
which in my experience reduces RAM usage by approx. 15 MB on startup.
Click to expand...
Click to collapse
Thanks man, i add this later

Nice one frank,ButI think Mediastatefright breaks HD Video

PhosgenMod init.d + build.prop
PhosgenCharger
Code:
echo "0,3,5,7,14,15" > /sys/module/lowmemorykiller/parameters/adj; # OOM Grouping
echo "1536,2048,4096,10240,12800,15360"> /sys/module/lowmemorykiller/parameters/minfree;
PhosgenCore
Code:
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]
then
/system/xbin/echo "4096" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
fi;
if [ -e /sys/devices/virtual/bdi/179:8/read_ahead_kb ]
then
/system/xbin/echo "4096" > /sys/devices/virtual/bdi/179:8/read_ahead_kb;
fi;
if [ -e /sys/devices/virtual/bdi/default/read_ahead_kb ]
then
/system/xbin/echo "4096" > /sys/devices/virtual/bdi/default/read_ahead_kb;
fi;
if [ -e /sys/module/lowmemorykiller/parameters/adj ]; then
echo "0,1,2,4,6,15" > /sys/module/lowmemorykiller/parameters/adj
fi
if [ -e /sys/module/lowmemorykiller/parameters/minfree ]; then
echo "2560,4096,5632,10240,11776,14848" > /sys/module/lowmemorykiller/parameters/minfree
fi
if [ -e /proc/sys/vm/swappiness ]; then
echo "20" > /proc/sys/vm/swappiness
fi
if [ -e /proc/sys/vm/vfs_cache_pressure ]; then
echo "70" > /proc/sys/vm/vfs_cache_pressure
fi
if [ -e /proc/sys/vm/dirty_expire_centisecs ]; then
echo "3000" > /proc/sys/vm/dirty_expire_centisecs
fi
if [ -e /proc/sys/vm/dirty_writeback_centisecs ]; then
echo "450" > /proc/sys/vm/dirty_writeback_centisecs
fi
if [ -e /proc/sys/vm/dirty_ratio ]; then
echo "10" > /proc/sys/vm/dirty_ratio
fi
if [ -e /proc/sys/vm/dirty_background_ratio ]; then
echo "2" > /proc/sys/vm/dirty_background_ratio
fi
LOG_FILE=/data/zipalign.log;
ZIPALIGNDB=/data/zipalign.db;
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
if [ ! -f $ZIPALIGNDB ]; then
touch $ZIPALIGNDB;
fi;
echo "Starting FV Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for DIR in /system/app /data/app; do
cd $DIR;
for APK in *.apk; do
if [ $APK -ot $ZIPALIGNDB ] && [ $(grep "$DIR/$APK" $ZIPALIGNDB|wc -l) -gt 0 ]; then
echo "Already checked: $DIR/$APK" | tee -a $LOG_FILE;
else
ZIPCHECK=`/system/xbin/zipalign -c -v 4 $APK | grep FAILED | wc -l`;
if [ $ZIPCHECK == "1" ]; then
echo "Now aligning: $DIR/$APK" | tee -a $LOG_FILE;
/system/xbin/zipalign -v -f 4 $APK /data/local/$APK;
busybox mount -o rw,remount /system;
cp -f -p /data/local/$APK $APK;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
else
echo "Already aligned: $DIR/$APK" | tee -a $LOG_FILE;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
fi;
fi;
done;
done;
busybox mount -o ro,remount /system;
touch $ZIPALIGNDB;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
MODULES="ipv6"
for i in $MODULES;
do
modprobe $i;
done
sysctl -p /etc/sysctl.conf;
LOOP=`ls -d /sys/block/loop*`;
blk0=`ls -d /sys/block/mmcblk0`;
blk1=`ls -d /sys/block/mmcblk1`;
MMC=`ls -d /sys/block/mmc*`;
for j in $blk0 $blk1; do
echo "0" > $j/queue/rotational;
echo "4096" > $j/queue/read_ahead_kb;
done;
for k in $(busybox mount | grep relatime | cut -d " " -f3) ; do
sync;
busybox mount -o remount,noatime $k;
done;
for i in /sys/block/*/queue/scheduler ; do
echo "noop" > $i;
done;
for a in $blk0 $blk1 $MMC ; do
echo "512" > $a/queue/nr_requests;
done;
for k in $(busybox mount | grep relatime | cut -d " " -f3) ; do
sync
busybox mount -o remount,noatime $k
done
STL=`ls -d /sys/block/stl*`;
BML=`ls -d /sys/block/bml*`;
MMC=`ls -d /sys/block/mmc*`;
ZRM=`ls -d /sys/block/zram*`;
MTD=`ls -d /sys/block/mtd*`;
for i in $STL $BML $MMC $TFSR; do
echo 0 > $i/queue/rotational
echo 1 > $i/queue/iosched/low_latency
echo 1 > $i/queue/iosched/back_seek_penalty
echo 1000000000 > $i/queue/iosched/back_seek_max
echo 3 > $i/queue/iosched/slice_idle
echo 16 > $i/queue/iosched/quantum
echo 1 > $i/queue/iosched/fifo_batch
echo sio > $i/queue/scheduler
done
if [ -n ${up_threshold} ];
then echo ${up_threshold} > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
fi
if [ -n ${sampling_rate} ];
then echo ${sampling_rate} > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
fi
if [ -e /sys/module/lowmemorykiller/parameters/adj ]; then
echo "0,1,2,4,7,15" > /sys/module/lowmemorykiller/parameters/adj
fi
if [ -e /sys/module/lowmemorykiller/parameters/minfree ]; then
echo "2560,4096,6144,12288,14336,18432" > /sys/module/lowmemorykiller/parameters/minfree
fi
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo "3072" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi
echo "deadline" > /sys/block/mmcblk0/queue/scheduler
echo "0" > /sys/block/mmcblk0/queue/rotational
echo "2048" > /sys/block/mmcblk0/queue/nr_requests
echo ${READ_AHEAD_KB} > /sys/block/mmcblk0/queue/read_ahead_kb
echo "deadline" > /sys/block/mmcblk1/queue/scheduler
echo "0" > /sys/block/mmcblk1/queue/rotational
echo "2048" > /sys/block/mmcblk1/queue/nr_requests
echo ${READ_AHEAD_KB} > /sys/block/mmcblk1/queue/read_ahead_kb
for i in \ `find /data -iname "*.db"` do \ sqlite3
$i 'VACUUM;'
done
echo "6144 87380 524288" > /proc/sys/net/ipv4/tcp_wmem
echo "6144 87380 524288" > /proc/sys/net/ipv4/tcp_rmem
setprop ro.telephony.call_ring.delay 0
setprop ring.delay 0
setprop windowsmgr.support_rotation_270 true
setprop ro.HOME_APP_ADJ 1
setprop ro.HOME_APP_MEM 2048
echo "500" > /proc/sys/vm/dirty_expire_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_centisecs
echo "0" > /proc/sys/net/ipv4/tcp_timestamps;
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse;
echo "1" > /proc/sys/net/ipv4/tcp_sack;
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle;
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling;
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout;
echo "404480" > /proc/sys/net/core/wmem_max;
echo "404480" > /proc/sys/net/core/rmem_max;
echo "256960" > /proc/sys/net/core/rmem_default;
echo "256960" > /proc/sys/net/core/wmem_default;
echo "4096,16384,404480" > /proc/sys/net/ipv4/tcp_wmem;
echo "4096,87380,404480" > /proc/sys/net/ipv4/tcp_rmem;
PhosgenKNZO
Code:
b="busybox"; _e () { echo "$1" > "$2"; };
_m () { $b mount -o $mop -t $fs $1 $2 > /dev/nul 2>&1; };
_t1 () { tune2fs -o $1 $2; }; _t2 () { tune2fs -O $1 $2; };
_mt () { mount -o rw -t tmpfs tmpfs /data/data/$1; };
qa="com.aurorasoftworks.quadrant.ui.standard";
qs="com.aurorasoftworks.quadrant.ui.advanced";
_e "Smartassv2" /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
for i in /sys/block/*/queue/scheduler; do sync; echo "sio" > /$i; done;
sd="/sys/devices/virtual/bdi";
_e "1024" $sd/179:0/read_ahead_kb; _e "1024" $sd/default/read_ahead_kb;
if [ -e "$sd/179:16/read_ahead_kb" ]; then _e "1024" $sd/179:16/read_ahead_kb; else _e "1024" $sd/179:17/read_ahead_kb; fi;
PhosgenLoopy
Code:
###### Loopy Smoothness Tweak for PhosgenMod (Experimental) #######
sleep 3
renice 18 `pidof kswapd0` # please give credit and thanks to loopy for this line if it works
##### Set nice levels for smoothness loop BEGIN #####
### Let's loop this in the background for a bit
for i in {1..20}
do
sleep 5
### Phone dialer app ###
renice -20 `pidof com.android.phone`
### Launcher apps ###
renice -20 `pidof com.sec.android.app.twlauncher` # TouchWiz Launcher
renice -20 `pidof org.adwfreak.launcher` # ADW Launcher Ex
renice -20 `pidof org.zeam.core` # Zeam launcher
### System apps ###
renice -19 `pidof com.android.mms` # Text message app
renice -19 `pidof com.swype.android.inputmethod` # Swype keyboard
renice -15 `pidof com.sec.android.app.controlpanel` # Task manager
renice -15 `pidof com.android.systemui` # Status bar
renice -9 `pidof com.android.settings` # Settings menu
renice -9 `pidof com.android.browser` # Browser app
renice -9 `pidof com.android.vending` # Market app
renice -20 `pidof com.sec.android.app.camera` # Camera app
renice -6 `pidof com.sec.android.app.fm` # FM Radio app
renice -6 `pidof com.google.android.youtube` # YouTube app
renice -6 `pidof com.google.android.apps.maps` # Maps
renice -3 `pidof android.process.acore`
renice -3 `pidof android.process.media`
### Memory management kernel thread ###
renice 19 `pidof kswapd0` # please give credit and thanks to loopy for this line if it works
done
PhosgenTouch
Code:
echo 7035 > /sys/class/touch/switch/set_touchscreen;
echo 8002 > /sys/class/touch/switch/set_touchscreen;
echo 11000 > /sys/class/touch/switch/set_touchscreen;
echo 13060 > /sys/class/touch/switch/set_touchscreen;
echo 14005 > /sys/class/touch/switch/set_touchscreen;
PhosgenTune
Code:
if [ -e /sys/class/misc/gpu_clock_control/gpu_control ]; then
echo "100 200 267" > /sys/class/misc/gpu_clock_control/gpu_control;
echo "85% 45% 85% 70%" > /sys/class/misc/gpu_clock_control/gpu_control;
#echo "800000 850000 950000" > /sys/devices/virtual/misc/gpu_voltage_control/gpu_control;
fi;
if [ -e /sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table ]; then
#echo "1400 1300 1175 1075 975 850 825 825 " > /sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table;
fi;
for i in \
`busybox find /data -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
if [ -d "/dbdata" ]; then
for i in \
`busybox find /dbdata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
if [ -d "/datadata" ]; then
for i in \
`busybox find /datadata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
for i in \
`busybox find /sdcard -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
if [ "`grep 'quadrant.*true' $p`" ]; then
echo "`date` Enabling Quadrant hack..." >>$LOG
dd="/data/data"
qs="com.aurorasoftworks.quadrant.ui.standard"
qa="com.aurorasoftworks.quadrant.ui.advanced"
if [ -d "$dd/$qs" ]; then mount -t tmpfs tmpfs $dd/$qs; renice -20 `pidof $qs`; fi
if [ -d "$dd/$qa" ]; then mount -t tmpfs tmpfs $dd/$qa; renice -20 `pidof $qa`; fi
mount |grep quadrant >>$LOG
fi
if [ -e /sys/devices/system/cpu/cpufreq/smartass/awake_ideal_freq ]; then
echo "800000" > /sys/devices/system/cpu/cpufreq/smartass/awake_ideal_freq;
if [ "`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq`" -eq 200000 ]; then
echo "200000" > /sys/devices/system/cpu/cpufreq/smartass/sleep_ideal_freq;
else
echo "100000" > /sys/devices/system/cpu/cpufreq/smartass/sleep_ideal_freq;
fi;
echo "800000" > /sys/devices/system/cpu/cpufreq/smartass/sleep_wakeup_freq;
echo "85" > /sys/devices/system/cpu/cpufreq/smartass/max_cpu_load;
echo "75" > /sys/devices/system/cpu/cpufreq/smartass/min_cpu_load;
echo "200000" > /sys/devices/system/cpu/cpufreq/smartass/ramp_down_step;
echo "0" > /sys/devices/system/cpu/cpufreq/smartass/ramp_up_step;
fi;

XDA_Bam said:
Nice list.
I think ro.ril.disable.power.collapse should read
Code:
ro.ril.disable.power.collapse=0
because you want the power collapse to happen to save energy. Also, all commands should be lower case. Therefore it should be
Code:
debug.performance.tuning=1
video.accelerate.hw=1
with 'd' and 'v' instead of 'D' and 'V' at the beginning.
Further, I use
Code:
dalvik.vm.startheapsize=4m
which in my experience reduces RAM usage by approx. 15 MB on startup.
Click to expand...
Click to collapse
ro.ril.disable.power.collapse should be 1 to disable the power collapse

For collection of scripts and tweaks look here
send from gt-i9003 using android keyboard

sirilpta said:
For collection of scripts and tweaks look here
send from gt-i9003 using android keyboard
Click to expand...
Click to collapse
..Thanks!

TheFrankenstain said:
..Thanks!
Click to expand...
Click to collapse
in that link it is written
Code:
ro.ril.disable.power.collapse=0
The sense says it should be=1, so what do we use?
Another thing, we can't use all the build.prop lines of that link is this right?

Originally Posted by TheFrankenstain
..Thanks!
Click to expand...
Click to collapse
in that link it is written
ro.ril.disable.power.collapse=0
The sense says it should be=1, so what do we use?
Another thing, we can't use all the build.prop lines of that link is this right?
Click to expand...
Click to collapse
Just use the tweaks currently in the OP. I believe thefrankenstein will only state the tweaks that work.
Cheers
Sent from my GT-i9003 powered by MIUI

Nice work!
I'd changed the media builds yesterday, however, now i can't playing youtube's videos because when i press play button the Mobile become frigde and i only can to turn off pressing long the power button.
Can you give me thr factory status? I didn't a back up file :s
Thx!!
Enviado desde mi GT-I9003 usando Tapatalk

txitxo0 said:
Nice work!
I'd changed the media builds yesterday, however, now i can't playing youtube's videos because when i press play button the Mobile become frigde and i only can to turn off pressing long the power button.
Can you give me thr factory status? I didn't a back up file :s
Thx!!
Enviado desde mi GT-I9003 usando Tapatalk
Click to expand...
Click to collapse
When you edit build.prop, the phone automatically saves a build.prop.bak in the same location, just under your build.prop. Just rename it to build.prop and delete the bad one.

luiseteyo said:
When you edit build.prop, the phone automatically saves a build.prop.bak in the same location, just under your build.prop. Just rename it to build.prop and delete the bad one.
Click to expand...
Click to collapse
Thx a lot luiseteyo! I fell weird writing on english with you jaja
Enviado desde mi GT-I9003 usando Tapatalk

Related

[SCRIPTS] & [TWEAKS] - Updated 2.22.13

*****************************************************************************************************************
OK! Listen up! A little disclaimer before we begin...
XDA, Dwitherell and I are not responsible for you borking your phone while using these scripts!
Click to expand...
Click to collapse
*****************************************************************************************************************​
Now that, that is done and over with let's begin, shall we?
I have scoured the vast online community, that is the great XDA and have researched and tested various scripts(init.d) and tweaks(build.prop and gps.conf) to help our greatly handicapped Droid Charge somewhat "compete" with the big boys.
Dwitherell has kindly uploaded them to Tweaktools.
You may ask init.d? But we have a stock kernel that doesn't support init.d... Thanks to this post and Dwitherell's genius we have working init.d baked right into our ROM, yes that's right baked in!
P.S. - We now have a custom kernel that is able to use init.d tweaks without any hacks... Lazarus Recharged Kernel
RENICE Tutorial
Renice operates on the principal that the lower the value of the process (the scale is from -20 to +19), the higher the priority the process has on CPU time. In other words, a process that is nice to others, is +19. One that isn’t so nice is at -20. In function then, a process that requires lots of immediate CPU time such as a launcher, benefits from running at a higher priority (thus as a negative on the niceness scale) than, say, Google Maps.
***MAKE SURE TO CHANGE THE FIRST TWO ENTRYS TO YOUR CORRESPONDING PROGRAMS!***
***To add/remove other program names, change the PNAME value.***
Simply open your favorite file explorer(I recomend Script Manager, it is an all around good program), navigate to /data/data and in there are your programs. What I do is long press(in Script Manager) on the program select rename and copy the name, then paste it into the renice script. Simple as that.
Another way is to go to the Play Store find the app that you're trying to re-nice and click the share icon select Gmail or Messaging and you'll get a link. At the end of the link you'll see id=xxx.xxxxxxx.xxxxxxx copy what's after the equals sign and simply paste that into the script.
Feel free to add/delete programs from the list to suit your needs, as well as change the priority values.
Click to expand...
Click to collapse
Anywho, here is a run down of each of the modifications...
init.d
S2dSliceTweaks
[ Updated 1.4.13 ]
Code:
[B][COLOR="Red"]Various tweaks that will be known as [COLOR="black"]S2dSliceTweaks[/COLOR][/COLOR][/B]
#!/system/bin/sh
###################################
# Various tweaks found from XDA #
# - dSlice - #
###################################
# Strict Minfree Handler Tweak
####################################
echo "2048,3072,6144,15360,17920,20480" > /sys/module/lowmemorykiller/parameters/minfree
# Internet Speed Tweaks
#############################
echo "0" > /proc/sys/net/ipv4/tcp_timestamps;
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse;
echo "1" > /proc/sys/net/ipv4/tcp_sack;
echo "1" > /proc/sys/net/ipv4/tcp_dsack;
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle;
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling;
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout;
echo "1" > /proc/sys/net/ipv4/tcp_moderate_rcvbuf;
echo "1" > /proc/sys/net/ipv4/route/flush;
echo "6144" > /proc/sys/net/ipv4/udp_rmem_min;
echo "6144" > /proc/sys/net/ipv4/udp_wmem_min;
echo "1" > /proc/sys/net/ipv4/tcp_rfc1337;
echo "0" > /proc/sys/net/ipv4/ip_no_pmtu_disc;
echo "0" > /proc/sys/net/ipv4/tcp_ecn;
echo "6144 87380 2097152" > /proc/sys/net/ipv4/tcp_wmem;
echo "6144 87380 2097152" > /proc/sys/net/ipv4/tcp_rmem;
echo "1" > /proc/sys/net/ipv4/tcp_fack;
echo "2" > /proc/sys/net/ipv4/tcp_synack_retries;
echo "2" > /proc/sys/net/ipv4/tcp_syn_retries;
echo "1" > /proc/sys/net/ipv4/tcp_no_metrics_save;
echo "1800" > /proc/sys/net/ipv4/tcp_keepalive_time;
echo "0" > /proc/sys/net/ipv4/ip_forward;
echo "0" > /proc/sys/net/ipv4/conf/default/accept_source_route;
echo "0" > /proc/sys/net/ipv4/conf/all/accept_source_route;
echo "0" > /proc/sys/net/ipv4/conf/all/accept_redirects;
echo "0" > /proc/sys/net/ipv4/conf/default/accept_redirects;
echo "0" > /proc/sys/net/ipv4/conf/all/secure_redirects;
echo "0" > /proc/sys/net/ipv4/conf/default/secure_redirects;
echo "0" > /proc/sys/net/ipv4/ip_dynaddr;
echo "1440000" > /proc/sys/net/ipv4/tcp_max_tw_buckets;
echo "57344 57344 524288" > /proc/sys/net/ipv4/tcp_mem;
echo "1440000" > /proc/sys/net/ipv4/tcp_max_tw_buckets;
echo "2097152" > /proc/sys/net/core/rmem_max;
echo "2097152" > /proc/sys/net/core/wmem_max;
echo "262144" > /proc/sys/net/core/rmem_default;
echo "262144" > /proc/sys/net/core/wmem_default;
echo "20480" > /proc/sys/net/core/optmem_max;
echo "2500" > /proc/sys/net/core/netdev_max_backlog;
echo "50" > /proc/sys/net/unix/max_dgram_qlen;
# VM Management Tweaks
############################
echo 3 > /proc/sys/vm/page-cluster;
echo 3000 > /proc/sys/vm/dirty_expire_centisecs;
echo 500 > /proc/sys/vm/dirty_writeback_centisecs;
echo "5120" > /proc/sys/vm/min_free_kbytes;
echo "0" > /proc/sys/vm/oom_kill_allocating_task;
echo "0" > /proc/sys/vm/panic_on_oom;
echo "35" > /proc/sys/vm/dirty_background_ratio;
echo "70" > /proc/sys/vm/dirty_ratio;
echo "10" > /proc/sys/vm/vfs_cache_pressure;
echo "1" > /proc/sys/vm/overcommit_memory;
echo "4" > /proc/sys/vm/min_free_order_shift;
echo "0" > /proc/sys/vm/laptop_mode;
echo "0" > /proc/sys/vm/block_dump;
echo "1" > /proc/sys/vm/oom_dump_tasks;
# Misc Kernel Tweaks
##########################
echo "500,512000,64,2048" > /proc/sys/kernel/sem;
echo "268435456" > /proc/sys/kernel/shmmax;
echo "2097152" > /proc/sys/kernel/shmall;
echo "4096" > /proc/sys/kernel/shmmni;
echo "2048" > /proc/sys/kernel/msgmni;
echo "64000" > /proc/sys/kernel/msgmax;
echo "30" > /proc/sys/kernel/panic;
echo "0" > /proc/sys/kernel/panic_on_oops;
echo "5000" > /proc/sys/kernel/threads-max;
echo "10" > /proc/sys/fs/lease-break-time;
echo "65536" > /proc/sys/fs/file-max;
# Battery Tweaks
######################
echo "500" > /proc/sys/vm/dirty_expire_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_centisecs
# Removes Journalism
##########################
tune2fs -o journal_data_writeback /block/path/to/system
tune2fs -O ^has_journal /block/path/to/system
tune2fs -o journal_data_writeback /block/path/to/cache
tune2fs -O ^has_journal /block/path/to/cache
tune2fs -o journal_data_writeback /block/path/to/data
tune2fs -O ^has_journal /block/path/to/data
# Perfect Mount Options
#############################
busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0,nobh /system
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh /data
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh /cache
# Flags Blocks As Non-Rotational And Increases Cache Size
###############################################################
LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;
MMC=`ls -d /sys/block/mmc*`;
for j in $LOOP $RAM
do
echo "0" > $j/queue/rotational;
echo "2048" > $j/queue/read_ahead_kb;
done
# MicroSD Card Speed Tweak
################################
READ_AHEAD_KB="2049"
if [ -e /sys/devices/virtual/bdi/0:18/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/0:18/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:0/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:0/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:1/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:1/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:2/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:2/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:3/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:3/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:4/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:4/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:5/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:5/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:6/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:6/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:7/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:7/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/default/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/default/read_ahead_kb
fi
# Defrags Database Files
##############################
for i in \
`find /data -iname "*.db"`
do \
sqlite3 $i 'VACUUM;';
done
# Remove Logger
#####################
busybox rm /dev/log/main
# Ondemand Governor Tweaks
################################
SAMPLING_RATE=$(busybox expr `cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_transition_latency` \* 750 / 1000)
echo 95 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo $SAMPLING_RATE > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
# Auto Change Governor and I/O Scheduler
# I/O Scheduler (Best: MTD devices - VR; EMMC devices - SIO) - needs kernel with these
############################################################################################
echo "cfq" > /sys/block/mmcblk0/queue/scheduler
# Governor
################
echo "SmartAssV2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# Move Dalvik-Cache To Cache Partition (If It's Big Enough) To Free Up Data Partition Space
#################################################################################################
CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
if [ $CACHESIZE -gt 80000 ]
then
if [ ! -d /cache/dalvik-cache ]
then
busybox rm -rf /cache/dalvik-cache /data/dalvik-cache
mkdir /cache/dalvik-cache /data/dalvik-cache
fi
busybox chown 1000:1000 /cache/dalvik-cache
busybox chmod 0771 /cache/dalvik-cache
# bind mount dalvik-cache so we can still boot without the sdcard
busybox mount -o bind /cache/dalvik-cache /data/dalvik-cache
busybox chown 1000:1000 /data/dalvik-cache
busybox chmod 0771 /data/dalvik-cache
else
fi
# Disable normalize sleeper
#################################
mount -t debugfs none /sys/kernel/debug
echo NO_NORMALIZED_SLEEPER > /sys/kernel/debug/sched_features
# Clear Junk Caches And Junk Data
#######################################
busybox find /data/data -type d -iname "*cache*" -exec busybox rm -f {}/* ';' -exec echo "Cleared {}" ';'
rm -f /data/local/*.apk
rm -f /data/local/tmp/*.apk
rm -f /data/*.log
rm -f /data/log/*.log
rm -f /cache/*.*
rm -f /cache/recovery/*.*
rm -f /data/system/dropbox/*.txt
rm -f /data/backup/pending/*.tmp
rm -f /data/tombstones/*.*
# Disable IO Stats To Reduce Overhead
###########################################
if [ -e $i/queue/iostats ];
then
echo "0" > $i/queue/iostats;
fi;
# SqLite Optimize
#######################
for i in \
`busybox find /data -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
if [ -d "/dbdata" ]; then
for i in \
`busybox find /dbdata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
if [ -d "/datadata" ]; then
for i in \
`busybox find /datadata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
for i in \
`busybox find /sdcard -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
# Ram Optimizers, Allows Ram Switching To Gaming And Multitasking
#######################################################################
if [ -e /sys/module/lowmemorykiller/parameters/adj ]; then
echo "0,1,2,4,6,15" > /sys/module/lowmemorykiller/parameters/adj
fi
if [ -e /sys/module/lowmemorykiller/parameters/minfree ]; then
echo "2560,4096,6144,11264,11776,14336" > /sys/module/lowmemorykiller/parameters/minfree
fi
if [ -e /proc/sys/vm/swappiness ]; then
echo "20" > /proc/sys/vm/swappiness
fi
if [ -e /proc/sys/vm/vfs_cache_pressure ]; then
echo "70" > /proc/sys/vm/vfs_cache_pressure
fi
if [ -e /proc/sys/vm/dirty_expire_centisecs ]; then
echo "3000" > /proc/sys/vm/dirty_expire_centisecs
fi
if [ -e /proc/sys/vm/dirty_writeback_centisecs ]; then
echo "500" > /proc/sys/vm/dirty_writeback_centisecs
fi
if [ -e /proc/sys/vm/dirty_ratio ]; then
echo "15" > /proc/sys/vm/dirty_ratio
fi
if [ -e /proc/sys/vm/dirty_background_ratio ]; then
echo "3" > /proc/sys/vm/dirty_background_ratio
fi
# From Darky's Zipalign Tweak
###################################
LOG_FILE=/data/zipalign.log;
ZIPALIGNDB=/data/zipalign.db;
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
if [ ! -f $ZIPALIGNDB ]; then
touch $ZIPALIGNDB;
fi;
echo "Starting FV Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for DIR in /system/app /data/app; do
cd $DIR;
for APK in *.apk; do
if [ $APK -ot $ZIPALIGNDB ] && [ $(grep "$DIR/$APK" $ZIPALIGNDB|wc -l) -gt 0 ]; then
echo "Already checked: $DIR/$APK" | tee -a $LOG_FILE;
else
ZIPCHECK=`/system/xbin/zipalign -c -v 4 $APK | grep FAILED | wc -l`;
if [ $ZIPCHECK == "1" ]; then
echo "Now aligning: $DIR/$APK" | tee -a $LOG_FILE;
/system/xbin/zipalign -v -f 4 $APK /data/local/$APK;
busybox mount -o rw,remount /system;
cp -f -p /data/local/$APK $APK;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
else
echo "Already aligned: $DIR/$APK" | tee -a $LOG_FILE;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
fi;
fi;
done;
done;
busybox mount -o ro,remount /system;
touch $ZIPALIGNDB;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
# Background Process To Optimize Dialer Process
#####################################################
(while [ 1 ];
do
sleep 10;
MAX_PHONE;
done &);
# Remove Lag When Answering Phone Calls
#############################################
MAX_PHONE()
{
pidphone=`pidof com.android.phone`;
if [ $pidphone ]; # Wait for com.android.phone to start;
then
echo -17 > /proc/$pidphone/oom_adj; # exclude com.android.phone from oom-killer;
renice -20 $pidphone; # set highest nice level for com.android.phone;
log -p i -t SSSwitch_v0.8 "*** MAX phone *** set oom_adj(-17) and nice(-20) for com.android.phone";
exit;
else
sleep 5;
MAX_PHONE;
fi;
}
S1dSliceRenice
[ Updated 1.4.13 ]
Code:
[B][COLOR="Red"]Rewritten RENICE script that is a new name [COLOR="black"]S1dSliceRenice[/COLOR][/COLOR][/B]
#!/system/bin/sh
##########################################################
# Renice processes at wake a.k.a. Loopy Smoothness Tweak #
##########################################################
for n in 1 2
do
USER_LAUNCHER="com.mobint.hololauncher" # Change this to your launcher app #
USER_INPUT_METHOD="com.nuance.swype.input" #Change this to your keyboard app #
################################## ##################################
# Common Launchers # # Common Keyboards #
# ---------------- # # ---------------- #
# com.sec.android.app.twlauncher # # com.swype.android.inputmethod #
# org.adwfreak.launcher # # com.touchtype.swiftkey #
# org.zeam.core # # com.cootek.smartinputv5 #
# com.gau.go.launcherex # # com.dasur.slideit.vt.lite #
################################## ##################################
###################################################
NUMBER_OF_CHECKS=60 # Total number of rechecks before ending 1st loop #
# ----------------------------------------------- #
SLEEP_TIME=3 # Number of seconds between re-checking processes #
#------------------------------------------------ #
PROCESSES_TOTAL=20 # Must be edited to match the #
# number of processes to be checked #
# ----------------------------------------------- #
DEBUG_ECHO=1 # Debug: ON (1) / OFF (0) #
# ----------------------------------------------- #
CHECK_COUNT=0 # DON'T EDIT!!!! DON'T EDIT!!!! DON'T EDIT!!!! #
# ----------------------------------------------- #
P_CHECK=0 # DON'T EDIT!!!! DON'T EDIT!!!! DON'T EDIT!!!! #
# ----------------------------------------------- #
CHECK_OK=0 # UN-USED ^('_')^ #
###################################################
PROCESS_1=0; PROCESS_2=0; PROCESS_3=0; PROCESS_4=0; PROCESS_5=0; PROCESS_6=0;
PROCESS_7=0; PROCESS_8=0; PROCESS_9=0; PROCESS_10=0; PROCESS_11=0; PROCESS_12=0;
PROCESS_13=0; PROCESS_14=0; PROCESS_15=0; PROCESS_16=0; PROCESS_17=0; PROCESS_18=0;
PROCESS_19=0; PROCESS_20=0; PROCESS_21=0; PROCESS_22=0; PROCESS_23=0; PROCESS_24=0;
if [ $n -eq "1" ]; then
if [ $DEBUG_ECHO -eq "1" ]; then
echo ""
echo "LST Debug: $(date)"
echo "LST Debug: Initiate"
fi;
#######################################################################
# Pause and then loop until kswapd0 is found, which should be instant #
#######################################################################
sleep 1
SWAP_SLEEP_TIME=3; SWAP_NUMBER_OF_CHECKS=30; SWAP_CHECK_COUNT=0; SWAP_CHECK_COUNT_OK=0; while [ $SWAP_CHECK_COUNT -lt $SWAP_NUMBER_OF_CHECKS ]; do if [ `pidof kswapd0` ]; then renice 19 `pidof kswapd0`; SWAP_CHECK_COUNT=$SWAP_NUMBER_OF_CHECKS; SWAP_CHECK_COUNT_OK=1; else sleep $SWAP_SLEEP_TIME; fi; SWAP_CHECK_COUNT=`expr $SWAP_CHECK_COUNT + 1`; done; if [ $SWAP_CHECK_COUNT_OK -lt 1 ]; then echo "LST Debug: 'kswapd0' expired after `expr $SWAP_CHECK_COUNT \* $SWAP_SLEEP_TIME` seconds"; fi;
if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: $(date)";
echo "LST Debug: kswapd0 found";
fi;
fi;
###############################
# Check briefly one more time #
###############################
if [ $n -eq "2" ]; then
if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: 2nd loop"
fi; ##################
NUMBER_OF_CHECKS=6 # DON'T EDIT!!!! #
SLEEP_TIME=5 # DON'T EDIT!!!! #
fi; ##################
while [ $CHECK_COUNT -lt $NUMBER_OF_CHECKS ];
do
########################
# Resident system apps #
# -------------------- #
# (No Need To Edit) #
########################
if [ $PROCESS_1 -eq "0" ]; then PNAME="com.android.phone"; NICELEVEL=-20; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_1=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_2 -eq "0" ]; then PNAME="com.android.systemui"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_2=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_3 -eq "0" ]; then PNAME="com.android.settings"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_3=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_4 -eq "0" ]; then PNAME="$USER_INPUT_METHOD"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_4=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_5 -eq "0" ]; then PNAME="$USER_LAUNCHER"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_5=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_6 -eq "0" ]; then PNAME="com.android.vending"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_6=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_7 -eq "0" ]; then PNAME="com.android.mms"; NICELEVEL=-19; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_7=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_8 -eq "0" ]; then PNAME="android.process.acore"; NICELEVEL=-3; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_8=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_9 -eq "0" ]; then PNAME="android.process.media"; NICELEVEL=-3; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_9=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
#####################
# Other system apps #
#####################
if [ $PROCESS_10 -eq "0" ]; then PNAME="com.sec.android.app.dialertab"; NICELEVEL=-19; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_10=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_11 -eq "0" ]; then PNAME="com.sec.android.app.samsungapps"; NICELEVEL=-19; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_11=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_12 -eq "0" ]; then PNAME="com.sec.android.app.controlpanel"; NICELEVEL=-18; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_12=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_13 -eq "0" ]; then PNAME="com.sec.android.app.camera"; NICELEVEL=-6; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_13=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
##############
# Other apps #
##############
if [ $PROCESS_14 -eq "0" ]; then PNAME="com.android.tsm_parts"; NICELEVEL=-15; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_14=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_15 -eq "0" ]; then PNAME="os.tools.scriptmanager"; NICELEVEL=-15; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_15=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_16 -eq "0" ]; then PNAME="com.mobint.locker"; NICELEVEL=-15; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_16=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_17 -eq "0" ]; then PNAME="com.android.browser"; NICELEVEL=-9; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_17=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_18 -eq "0" ]; then PNAME="com.google.android.youtube"; NICELEVEL=-6; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_18=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_19 -eq "0" ]; then PNAME="com.google.android.apps.maps"; NICELEVEL=-6; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_19=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
if [ $PROCESS_20 -eq "0" ]; then PNAME="pidof kondemand/0"; NICELEVEL=19; if [ `pidof $PNAME` ]; then renice $NICELEVEL `pidof $PNAME`; PROCESS_20=1; P_CHECK=`expr $P_CHECK + 1`; fi; fi;
####################################################
# If all processes are done, loop can finish early #
####################################################
if [ $P_CHECK -ge $PROCESSES_TOTAL ]; then CHECK_COUNT=$NUMBER_OF_CHECKS; else sleep $SLEEP_TIME; fi;
CHECK_COUNT=`expr $CHECK_COUNT + 1`;
done
if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: $(date)"
if [ $PROCESS_1 -eq "0" ]; then echo "LST Debug: PROCESS_1 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_2 -eq "0" ]; then echo "LST Debug: PROCESS_2 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_3 -eq "0" ]; then echo "LST Debug: PROCESS_3 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_4 -eq "0" ]; then echo "LST Debug: PROCESS_4 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_5 -eq "0" ]; then echo "LST Debug: PROCESS_5 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_6 -eq "0" ]; then echo "LST Debug: PROCESS_6 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_7 -eq "0" ]; then echo "LST Debug: PROCESS_7 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_8 -eq "0" ]; then echo "LST Debug: PROCESS_8 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_9 -eq "0" ]; then echo "LST Debug: PROCESS_9 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_10 -eq "0" ]; then echo "LST Debug: PROCESS_10 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_11 -eq "0" ]; then echo "LST Debug: PROCESS_11 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_12 -eq "0" ]; then echo "LST Debug: PROCESS_12 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_13 -eq "0" ]; then echo "LST Debug: PROCESS_13 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_14 -eq "0" ]; then echo "LST Debug: PROCESS_14 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_15 -eq "0" ]; then echo "LST Debug: PROCESS_15 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_16 -eq "0" ]; then echo "LST Debug: PROCESS_16 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_17 -eq "0" ]; then echo "LST Debug: PROCESS_17 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_18 -eq "0" ]; then echo "LST Debug: PROCESS_18 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_19 -eq "0" ]; then echo "LST Debug: PROCESS_19 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
if [ $PROCESS_20 -eq "0" ]; then echo "LST Debug: PROCESS_20 expired after `expr $CHECK_COUNT \* $SLEEP_TIME` seconds"; fi;
echo "LST Debug: Checking complete"
fi;
done
if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: Done"
echo ""
fi;
build.prop
[ Updated 11.12.12 ]
Code:
[B][COLOR="Red"]Added at the end of the defalut [COLOR="black"]build.prop[/COLOR][/COLOR][/B]
##################################
# Random tweaks I've come across #
# - dSlice - #
##################################
# Force launcher into memory
ro.HOME_APP_ADJ=1
# Raise JPG quality to 100%
ro.media.enc.jpeg.quality=100
# VM Heapsize
dalvik.vm.heapsize=48m
# Render UI with GPU
debug.sf.hw=1
# Decrease dialing out delay
ro.telephony.call_ring.delay=0
# Helps scrolling responsiveness
windowsmgr.max_events_per_sec=150
# Save battery
wifi.supplicant_scan_interval=180
pm.sleep_mode=1
ro.ril.disable.power.collapse=0
# Disable debugging notify icon on statusbar
persist.adb.notify=0
# Increase overall touch responsiveness
debug.performance.tuning=1
video.accelerate.hw=1
# Raise photo and video recording quality
ro.media.dec.jpeg.memcap=8000000
ro.media.enc.hprof.vid.bps=8000000
# Signal (3G) tweaks
ro.ril.hsxpa=2
ro.ril.gprsclass=10
ro.ril.hep=1
ro.ril.enable.dtm=1
ro.ril.hsdpa.category=10
ro.ril.enable.a53=1
ro.ril.enable.3g.prefix=1
ro.ril.htcmaskw1.bitmask=4294967295
ro.ril.htcmaskw1=14449
ro.ril.hsupa.category=5
# Net speed tweaks
net.tcp.buffersize.default=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,16384,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,16384,256960
# Disable blackscreen issue after a call
ro.lge.proximity.delay=25
mot.proximity.delay=25
# Fix some application issues
ro.kernel.android.checkjni=0
# Disable boot animation for faster boot
debug.sf.nobootanimation=1
# Miscellaneous flags
ro.config.hw_menu_unlockscreen=false
persist.sys.use_dithering=1
persist.sys.purgeable_assets=1
dalvik.vm.dexopt-flags=m=y
ro.mot.eri.losalert.delay=1000
le_assets=1
ri.losalert.delay=1000
###########
# UPDATES #
# 11.12 #
# .12 #
###########
# Performance Tweaks
ro.foreground_app_mem=1280
ro.visible_app_mem=2560
ro.perceptible_app_mem=3840
ro.heavy_weight_app_mem=6400
ro.secondary_server_mem=7680
ro.backup_app_mem=8960
ro.home_app_mem=2048
ro.hidden_app_mem=12800
ro.content_provider_mem=15360
ro.empty_app_mem=20480
ro.foreground_app_adj=0
ro.visible_app_adj=1
ro.perceptible_app_adj=2
ro.heavy_weight_app_adj=4
ro.secondary_server_adj=5
ro.backup_app_adj=6
ro.home_app_adj=1
ro.hidden_app_min_adj=7
setprop ro.empty_app_adj=15
# Memory
dalvik.vm.startheapsize=8m
# Disable kernel error checking
ro.kernel.checkjni=0
# Scrolling speed
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
# Smoother video streaming
media.stagefright.enable-player=true
media.stagefright.enable-meta=true
media.stagefright.enable-scan=false
media.stagefright.enable-http=true
gps.conf
[ Updated 11.9.12 ]
Code:
[B][COLOR="Red"]These will replace the defalut [COLOR="black"]gps.conf[/COLOR][/COLOR][/B]
### Credit goes to crypted @
### http://forum.xda-developers.com/showthread.php?t=1250226
### for this brilliant work and shrike1978 for sharing it.
##################################################
### NTP IS NETWORK TIME PROTOCOL AND PROVIDES ###
### A TIME-HACK TO DEVICES THAT HAVE SYNCING ###
### MADE READLIY POSSIBLE. MANY XDA PATCHES ###
### MISINTERPRET WHAT NTP IS AND IMPORTANCE. ###
### NTP PACKETS HAVE BUILT-IN MECHANISMS FOR ###
### TRANSMISSION LOSS. NTP PACKETS ARE VERY ###
### SMALL. LASTLY, NTP MATTERS FOR PARSING ###
### THE XTRA.BIN. BUT, IT ONLY MATTERS WHEN ###
### YOUR DEVICE HAS ITS TIME EXTREMELY OFFSET ###
### COMPARED TO REALITY. THUS, I BUILT THIS ###
### PATCH FOR WORLDWIDE OPERATION. RARELY ###
### WOULD LOCAL NTP SERVERS BE REQUIRED. ###
##################################################
NTP_SERVER=ntp.derekgordon.com
###
##################################################
### AGPS AND XTRA TELL THE AGPS DAEMON WHERE ###
### IT MAY LOCATE THE AGPS DATA. THE DATA ###
### OPERATES AS AN ALMANAC WITH THE LOCATION ###
### OF GPS SATS STORED WITHIN IT. THIS DATA ###
### IS ONLY VALID FOR 24 HOURS. IT WILL BE ###
### DOWNLOADED AND CACHED. IT IS NO LONGER ###
### KEPT IN THE /DATA/ PARTITION PERMANENTLY. ###
### THERE IS NO POINT TO KEEP IT THERE! ###
##################################################
### MY SERVER PROCESSES THE XTRA.BIN EVERY 30 ###
### MINUTES. TYPICALLY IT UPDATES EVERY HOUR ###
### WHEN NEW DATA IS AVAILABLE. ###
### SHOULD MY SERVER BECOME OVERLOADED, I WILL ###
### NEED DONATIONS TO KEEP THIS SUCKER STORED ###
### AT MORE LOCATIONS. ###
##################################################
AGPS=http://derekgordon.com/gps-files/bin/xtra.bin
XTRA_SERVER_1=http://derekgordon.com/gps-files/bin/xtra.bin
XTRA_SERVER_2=http://xtra3.gpsonextra.net/xtra.bin
XTRA_SERVER_3=http://xtra2.gpsonextra.net/xtra.bin
###
##################################################
### NOT GOING TO GO INTO DETAIL HERE. THESE ###
### NEED TO BE CALLED FIRST IN GPS DAEMON ###
### STARTUP. RELATES TO AGPS AND SUPL. ###
##################################################
DEFAULT_AGPS_ENABLE=TRUE
DEFAULT_USER_PLANE=TRUE
DEFAULT_SSL_ENABLE=FALSE
###
##################################################
### INTERMEDIATE POS RELATES TO USING GPS DATA ###
### FROM SATS THAT ARE NOT FULLY LOCKED. ###
### THE ACCURACY VARIABLE IS A THRESHOLD MAX ###
### ON DEVIATIONS FROM THE ASSUMED LOCATION ###
### WHERE THE DEVICE WILL DISCARD DATA. ###
### THIS VARIABLE IS =0 IN ALTERNATE BUILDS ###
##################################################
INTERMEDIATE_POS=1
ACCURACY_THRES=3000
###
##################################################
### THIS IS QUALITY OF SERVICE INFORMATION FOR ###
### PROCESSING THE GPS DATA. MOST SHOULD BE ###
### SELF-EXPLANATORY. GPS DATA OUTSIDE THE ###
### ACCURACY AND THRESHOLD RANGE WILL NOT BE ###
### USED WHEN POSITIONING DATA. ###
##################################################
QOS_ACCURACY=50
QOS_TIME_OUT_AGPS=95
QOS_TIME_OUT_STANDALONE=80
QosHorizontalThreshold=1000
QosVerticalThreshold=500
###
##################################################
### THESE VARIABLES RELATE TO AGPS. IT SAYS TO ###
### USE AGPS. THIS WILL NOT BE USED IF YOUR ###
### ROM HAS AGPS DISABLED IN THE CODE. ###
### THE SERVER IP IS FOR AN INTERNAL IP FOR ###
### ACCESSING THE AGPS DAEMONS DATA WHEN IT ###
### IS OPERATIONAL. ###
##################################################
AssistMethodType=1
AgpsUse=1
AgpsServerType=1
AgpsServerIp=3232235555
AgpsMtConf=0
AgpsMtResponseType=1
###
##################################################
### THIS SUPL DATA IS TO MATCH THE SUPLROOTCERT ##
### IF IT IS REQUIRED BY THE SUPL SERVER. ###
##################################################
SUPL_HOST=supl.google.com
SUPL_PORT=7276
#SUPL_SECURE_PORT=7275
SUPL_NO_SECURE_PORT=3425
#SUPL_TLS_HOST=FQDN
#SUPL_TLS_CERT=/etc/SuplRootCert
REPORT_POSITION_USE_SUPL_REFLOC=1
###
####################################################
### Carrier tags used universally in GPS configs ###
####################################################
CURRENT_CARRIER=common
PHONE_TYPE=UMTS
###
Script Manager Scripts
These are from V6 SuperCharger that Zeppelinrox made
Fast Engine Flush (Clears Cache and Frees RAM)
Detailing (Defrags the system)
Super Clean (Wipes Dalvik Cache)
These work great as a Script Manager Widget. All you have to do is click it and you are good.
Install Instructions:
1. Download from the links below
2. Place on root of SD Card or create a folder called Scripts on SD Card
3. Open Script Mananger
4. Locate scripts
5. Click on script
6. Click Fav (Star) and Su (Skull and Cross bones)
7. Click Save
8. Repeat 4 - 7 for additional scripts.
9. Go Home
10. Add a new widget to your desired home screen.
11. Select SMWidgets
12. Select script
13. Repeat 9 - 12 for additional scripts.
14. Enjoy!
Click to expand...
Click to collapse
If you come across any others left me know and I'll add it in(with credit of course). That is all. Have fun! :good:
- dSlice
For those who want to do thier own editing... USER BEWARE, USE AT YOUR OWN RISK
Downloads:
init.d Install instructions
S2dSliceTweaks
1. Open Terminal
2. Type 'su' (Without the quotes.)
3. Type 'tweaktools' (Without the quotes.)
4. Type 3
5. Type 1
6. Type 5
7. Type 1
8. Enjoy!
Click to expand...
Click to collapse
S1dSliceRenice
1. Open Terminal
2. Type 'su' (Without the quotes.)
3. Type 'tweaktools' (Without the quotes.)
4. Type 3
5. Type 1
6. Type 6
7. Type 1
8. Enjoy!
Click to expand...
Click to collapse
build.prop Install instructions
1. Open Terminal
2. Type 'su' (Without the quotes.)
3. Type 'tweaktools' (Without the quotes.)
4. Type 5
5. Type 2
6. Type 3
7. Type 2
8. Enjoy!
Click to expand...
Click to collapse
gps.conf Install Instructions
1. Open Terminal
2. Type 'su' (Without the quotes.)
3. Type 'tweaktools' (Without the quotes.)
4. Type 3
5. Type 2
6. Type 2
7. Type 1
8. Enjoy!
Click to expand...
Click to collapse
Script Manager Scripts
Download to the root of your SD Card or put into a folder on SD Card (ie. Scripts).
Fast Engine Flush
https://www.dropbox.com/s/2uhiahq4ujaz2c0/%21FastEngineFlush.sh
Detailing
https://www.dropbox.com/s/ljtt38cnin86et8/%21Detailing.sh
Super Clean
https://www.dropbox.com/s/zs7novx3d6j0g7o/%21SuperClean.sh
Update Log:
1.4.13
- Cleaned up the post.
- Renamed the tweak file to S2dSliceTweaks and updated it correspond with the new Lazarus Kernel.
- Re-wrote the RENICE file to actually work and tried to make it user friendly also renamed it to S1dSliceRenice.
- Fixed some things in the post.
Click to expand...
Click to collapse
11.26.12
- Cleaned up the post.
Click to expand...
Click to collapse
11.15.12
- Added three Script Manager scripts found in V6 SuperCharger.
Click to expand...
Click to collapse
11.13.12
- A major 77tweaks overhaul! (Reorganized, added / fixed code, implimented Darkly's ZipAlign into the file)
- Added a poll.
Click to expand...
Click to collapse
11.12.12
- Updated OP with download instructions for build.prop / removed link to buld.prop.
Click to expand...
Click to collapse
11.12.12
- Fixed and updated the build.prop (Conflicting VM Heap Sizes) - Thanks to Blackness!
- Modified build.prop (Added Performance, Memory, Kernel, Scrolling Speed, and Smoother Video Streaming Tweaks)
Click to expand...
Click to collapse
11.9.12
- Added newer, better, shinier gps.conf thanks to shrike1978 for pointing it out.
- Added tutorial on how to enable init.d on stock kernel
- Added download link to new gps.conf and link to old gps.conf
- Added a RENICE tutorial.
Click to expand...
Click to collapse
Change Log:
[1.4.13] - Renamed the RENICE and tweaks file, Re-wrote RENICE file, fixed tweaks file for the Lazarus Kernel.
[11.26.12] - Removed download links for: 77tweaks, renice and build.prop.
[11.15.12] - Added three Script Manager scripts found in V6 SuperCharger.
[11.13.12] - New 77tweaks content.
Code:
# Internet Speed Tweaks
#############################
echo "0" > /proc/sys/net/ipv4/tcp_timestamps;
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse;
echo "1" > /proc/sys/net/ipv4/tcp_sack;
echo "1" > /proc/sys/net/ipv4/tcp_dsack;
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle;
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling;
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout;
echo "1" > /proc/sys/net/ipv4/tcp_moderate_rcvbuf;
echo "1" > /proc/sys/net/ipv4/route/flush;
echo "6144" > /proc/sys/net/ipv4/udp_rmem_min;
echo "6144" > /proc/sys/net/ipv4/udp_wmem_min;
echo "1" > /proc/sys/net/ipv4/tcp_rfc1337;
echo "0" > /proc/sys/net/ipv4/ip_no_pmtu_disc;
echo "0" > /proc/sys/net/ipv4/tcp_ecn;
echo "6144 87380 2097152" > /proc/sys/net/ipv4/tcp_wmem;
echo "6144 87380 2097152" > /proc/sys/net/ipv4/tcp_rmem;
echo "1" > /proc/sys/net/ipv4/tcp_fack;
echo "2" > /proc/sys/net/ipv4/tcp_synack_retries;
echo "2" > /proc/sys/net/ipv4/tcp_syn_retries;
echo "1" > /proc/sys/net/ipv4/tcp_no_metrics_save;
echo "1800" > /proc/sys/net/ipv4/tcp_keepalive_time;
echo "0" > /proc/sys/net/ipv4/ip_forward;
echo "0" > /proc/sys/net/ipv4/conf/default/accept_source_route;
echo "0" > /proc/sys/net/ipv4/conf/all/accept_source_route;
echo "0" > /proc/sys/net/ipv4/conf/all/accept_redirects;
echo "0" > /proc/sys/net/ipv4/conf/default/accept_redirects;
echo "0" > /proc/sys/net/ipv4/conf/all/secure_redirects;
echo "0" > /proc/sys/net/ipv4/conf/default/secure_redirects;
echo "0" > /proc/sys/net/ipv4/ip_dynaddr;
echo "1440000" > /proc/sys/net/ipv4/tcp_max_tw_buckets;
echo "57344 57344 524288" > /proc/sys/net/ipv4/tcp_mem;
echo "1440000" > /proc/sys/net/ipv4/tcp_max_tw_buckets;
echo "2097152" > /proc/sys/net/core/rmem_max;
echo "2097152" > /proc/sys/net/core/wmem_max;
echo "262144" > /proc/sys/net/core/rmem_default;
echo "262144" > /proc/sys/net/core/wmem_default;
echo "20480" > /proc/sys/net/core/optmem_max;
echo "2500" > /proc/sys/net/core/netdev_max_backlog;
echo "50" > /proc/sys/net/unix/max_dgram_qlen;
# VM Management Tweaks
############################
echo 3 > /proc/sys/vm/page-cluster;
echo 3000 > /proc/sys/vm/dirty_expire_centisecs;
echo 500 > /proc/sys/vm/dirty_writeback_centisecs;
echo "5120" > /proc/sys/vm/min_free_kbytes;
echo "0" > /proc/sys/vm/oom_kill_allocating_task;
echo "0" > /proc/sys/vm/panic_on_oom;
echo "35" > /proc/sys/vm/dirty_background_ratio;
echo "70" > /proc/sys/vm/dirty_ratio;
echo "10" > /proc/sys/vm/vfs_cache_pressure;
echo "1" > /proc/sys/vm/overcommit_memory;
echo "4" > /proc/sys/vm/min_free_order_shift;
echo "0" > /proc/sys/vm/laptop_mode;
echo "0" > /proc/sys/vm/block_dump;
echo "1" > /proc/sys/vm/oom_dump_tasks;
# Misc Kernel Tweaks
##########################
echo "500,512000,64,2048" > /proc/sys/kernel/sem;
echo "268435456" > /proc/sys/kernel/shmmax;
echo "2097152" > /proc/sys/kernel/shmall;
echo "4096" > /proc/sys/kernel/shmmni;
echo "2048" > /proc/sys/kernel/msgmni;
echo "64000" > /proc/sys/kernel/msgmax;
echo "30" > /proc/sys/kernel/panic;
echo "0" > /proc/sys/kernel/panic_on_oops;
echo "5000" > /proc/sys/kernel/threads-max;
echo "10" > /proc/sys/fs/lease-break-time;
echo "65536" > /proc/sys/fs/file-max;
# MicroSD Card Speed Tweak
################################
READ_AHEAD_KB="2049"
if [ -e /sys/devices/virtual/bdi/0:18/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/0:18/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:0/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:0/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:1/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:1/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:2/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:2/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:3/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:3/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:4/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:4/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:5/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:5/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:6/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:6/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/7:7/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:7/read_ahead_kb
fi
if [ -e /sys/devices/virtual/bdi/default/read_ahead_kb ]; then
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/default/read_ahead_kb
fi
# Remove Logger
#####################
busybox rm /dev/log/main
# Clear Junk Caches And Junk Data
#######################################
busybox find /data/data -type d -iname "*cache*" -exec busybox rm -f {}/* ';' -exec echo "Cleared {}" ';'
rm -f /data/local/*.apk
rm -f /data/local/tmp/*.apk
rm -f /data/*.log
rm -f /data/log/*.log
rm -f /cache/*.*
rm -f /cache/recovery/*.*
rm -f /data/system/dropbox/*.txt
rm -f /data/backup/pending/*.tmp
rm -f /data/tombstones/*.*
# Disable IO Stats To Reduce Overhead
###########################################
if [ -e $i/queue/iostats ];
then
echo "0" > $i/queue/iostats;
fi;
# SqLite Optimize
#######################
for i in \
`busybox find /data -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
if [ -d "/dbdata" ]; then
for i in \
`busybox find /dbdata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
if [ -d "/datadata" ]; then
for i in \
`busybox find /datadata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
for i in \
`busybox find /sdcard -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
# Ram Optimizers, Allows Ram Switching To Gaming And Multitasking
#######################################################################
if [ -e /sys/module/lowmemorykiller/parameters/adj ]; then
echo "0,1,2,4,6,15" > /sys/module/lowmemorykiller/parameters/adj
fi
if [ -e /sys/module/lowmemorykiller/parameters/minfree ]; then
echo "2560,4096,6144,11264,11776,14336" > /sys/module/lowmemorykiller/parameters/minfree
fi
if [ -e /proc/sys/vm/swappiness ]; then
echo "20" > /proc/sys/vm/swappiness
fi
if [ -e /proc/sys/vm/vfs_cache_pressure ]; then
echo "70" > /proc/sys/vm/vfs_cache_pressure
fi
if [ -e /proc/sys/vm/dirty_expire_centisecs ]; then
echo "3000" > /proc/sys/vm/dirty_expire_centisecs
fi
if [ -e /proc/sys/vm/dirty_writeback_centisecs ]; then
echo "500" > /proc/sys/vm/dirty_writeback_centisecs
fi
if [ -e /proc/sys/vm/dirty_ratio ]; then
echo "15" > /proc/sys/vm/dirty_ratio
fi
if [ -e /proc/sys/vm/dirty_background_ratio ]; then
echo "3" > /proc/sys/vm/dirty_background_ratio
fi
# From Darky's Zipalign Tweak
###################################
LOG_FILE=/data/zipalign.log;
ZIPALIGNDB=/data/zipalign.db;
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
if [ ! -f $ZIPALIGNDB ]; then
touch $ZIPALIGNDB;
fi;
echo "Starting FV Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for DIR in /system/app /data/app; do
cd $DIR;
for APK in *.apk; do
if [ $APK -ot $ZIPALIGNDB ] && [ $(grep "$DIR/$APK" $ZIPALIGNDB|wc -l) -gt 0 ]; then
echo "Already checked: $DIR/$APK" | tee -a $LOG_FILE;
else
ZIPCHECK=`/system/xbin/zipalign -c -v 4 $APK | grep FAILED | wc -l`;
if [ $ZIPCHECK == "1" ]; then
echo "Now aligning: $DIR/$APK" | tee -a $LOG_FILE;
/system/xbin/zipalign -v -f 4 $APK /data/local/$APK;
busybox mount -o rw,remount /system;
cp -f -p /data/local/$APK $APK;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
else
echo "Already aligned: $DIR/$APK" | tee -a $LOG_FILE;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
fi;
fi;
done;
done;
busybox mount -o ro,remount /system;
touch $ZIPALIGNDB;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
# Background Process To Optimize Dialer Process
#####################################################
(while [ 1 ];
do
sleep 10;
MAX_PHONE;
done &);
# Remove Lag When Answering Phone Calls
#############################################
MAX_PHONE()
{
pidphone=`pidof com.android.phone`;
if [ $pidphone ]; # Wait for com.android.phone to start;
then
echo -17 > /proc/$pidphone/oom_adj; # exclude com.android.phone from oom-killer;
renice -20 $pidphone; # set highest nice level for com.android.phone;
log -p i -t SSSwitch_v0.8 "*** MAX phone *** set oom_adj(-17) and nice(-20) for com.android.phone";
exit;
else
sleep 5;
MAX_PHONE;
fi;
}
[11.12.12] - Updated OP with download instructions for build.prop / removed link to build.prop.
[11.12.12] - New build.prop edits.
Code:
# Performance Tweaks
ro.foreground_app_mem=1280
ro.visible_app_mem=2560
ro.perceptible_app_mem=3840
ro.heavy_weight_app_mem=6400
ro.secondary_server_mem=7680
ro.backup_app_mem=8960
ro.home_app_mem=2048
ro.hidden_app_mem=12800
ro.content_provider_mem=15360
ro.empty_app_mem=20480
ro.foreground_app_adj=0
ro.visible_app_adj=1
ro.perceptible_app_adj=2
ro.heavy_weight_app_adj=4
ro.secondary_server_adj=5
ro.backup_app_adj=6
ro.home_app_adj=1
ro.hidden_app_min_adj=7
setprop ro.empty_app_adj=15
# Memory
dalvik.vm.startheapsize=8m
# Disable kernel error checking
ro.kernel.checkjni=0
# Scrolling speed
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
# Smoother video streaming
media.stagefright.enable-player=true
media.stagefright.enable-meta=true
media.stagefright.enable-scan=false
media.stagefright.enable-http=true[/CENTER]
[11.9.12] - Old gps.conf file.
Code:
[B][COLOR="Red"]These will replace the defalut [COLOR="black"]gps.conf[/COLOR][/COLOR][/B]
[U]For improving GPS lock time and signal.[/U]
NTP_SERVER=america.pool.ntp.org
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
[U]SE supl for A-GPS (better than Nokia's or Google's)[/U]
SUPL_HOST=supl.sonyericsson.com
SUPL_PORT=7275
Download link:
http://db.tt/uaz10Wi7​
​
Have you seen the AGPS patch here? http://forum.xda-developers.com/showthread.php?t=1250226
Grab the Google specific No-SSL version. It's the one I bundle with my Rezound rom, and it's fantastic. He runs his own XTRA servers, updated with fresh data every 30 minutes, and runs his own stratum 2 NTP server just for AGPS. The patch also contains a lot more config tweaks related to AGPS timouts and accuracy requirements. The Rezound GPS isn't bad on it's own, but that gives it into the best GPS performance I've ever seen, including my $350 handheld. It locks in 2 seconds, locks to multiple satellites indoors, gives sub-10ft accuracy, etc. I don't know how well it will do on the Charge, but seeing as how both phones use Qualcomm chipsets, I can't imagine that it wouldn't work for the Charge.
Also... init.d stuff is not officially implemented... yet
dwitherell said:
Also... init.d stuff is not officially implemented... yet
Click to expand...
Click to collapse
I sent you a PM about that...
shrike1978 said:
Have you seen the AGPS patch here? http://forum.xda-developers.com/showthread.php?t=1250226
Grab the Google specific No-SSL version. It's the one I bundle with my Rezound rom, and it's fantastic. He runs his own XTRA servers, updated with fresh data every 30 minutes, and runs his own stratum 2 NTP server just for AGPS. The patch also contains a lot more config tweaks related to AGPS timouts and accuracy requirements. The Rezound GPS isn't bad on it's own, but that gives it into the best GPS performance I've ever seen, including my $350 handheld. It locks in 2 seconds, locks to multiple satellites indoors, gives sub-10ft accuracy, etc. I don't know how well it will do on the Charge, but seeing as how both phones use Qualcomm chipsets, I can't imagine that it wouldn't work for the Charge.
Click to expand...
Click to collapse
No but I have now and will research that. Thanks Shrike!
After enabling init.d... if I want all the 77tweaks...all I need to do is follow the placement stated to install it (/system/etc/init.d) ?
Sent from my SCH-I510 using xda premium
chefthomas99 said:
After enabling init.d... if I want all the 77tweaks...all I need to do is follow the placement stated to install it (/system/etc/init.d) ?
Sent from my SCH-I510 using xda premium
Click to expand...
Click to collapse
That is correct.
Sent from my SCH-I510 using xda premium
Also after putting in the new renice scripts...They will be accessible via tweaktools? Just needing clarification Awesome work!
Or a step by step would be greatly helpful please
"Change based on your needs" what do I do?
Sent from my SCH-I510 using xda premium
---------- Post added at 11:48 AM ---------- Previous post was at 11:22 AM ----------
Might be better off on waiting for the next Tweaked edition.
Sent from my SCH-I510 using xda premium
chefthomas99 said:
Also after putting in the new renice scripts...They will be accessible via tweaktools? Just needing clarification Awesome work!
Or a step by step would be greatly helpful please
"Change based on your needs" what do I do?
Sent from my SCH-I510 using xda premium
---------- Post added at 11:48 AM ---------- Previous post was at 11:22 AM ----------
Might be better off on waiting for the next Tweaked edition.
Sent from my SCH-I510 using xda premium
Click to expand...
Click to collapse
They will be in Tweaktools when 3.1 is released.
I updated the OP with renice instructions.
shrike1978 said:
Have you seen the AGPS patch here? http://forum.xda-developers.com/showthread.php?t=1250226
Grab the Google specific No-SSL version. It's the one I bundle with my Rezound rom, and it's fantastic. He runs his own XTRA servers, updated with fresh data every 30 minutes, and runs his own stratum 2 NTP server just for AGPS. The patch also contains a lot more config tweaks related to AGPS timouts and accuracy requirements. The Rezound GPS isn't bad on it's own, but that gives it into the best GPS performance I've ever seen, including my $350 handheld. It locks in 2 seconds, locks to multiple satellites indoors, gives sub-10ft accuracy, etc. I don't know how well it will do on the Charge, but seeing as how both phones use Qualcomm chipsets, I can't imagine that it wouldn't work for the Charge.
Click to expand...
Click to collapse
First lock took about 10 seconds, second lock was instant. Thanks again shrike!
Sent from my SCH-I510 using xda premium
Just installed with no issues and performed the required 2 reboots. The second reboot was three times faster than any other time I've rebooted. Is this a benefit of the tweaks?
Thanks for contributing to the community! I love that we still have active devs
dSlice said:
First lock took about 10 seconds, second lock was instant. Thanks again shrike!
Sent from my SCH-I510 using xda premium
Click to expand...
Click to collapse
Glad to hear it works well here. I remember GPS being awful and inconsistent on this phone.
Holy crap shrike. On my first go it locked onto 12 sats in 15 seconds on a cloudy day. The thread says the first time takes usually 20 seconds so I'm looking forward to using this over time.
Sent from my SCH-I510 using Tapatalk 2
I did something wrong. I installed init.d then copied 77tweaks and renice into the init.d file. I rebooted it once and it went fine. Then after i replaced the build.prop file with the down loaded one I restarted it and it went into boot loop. At least I guess that's what it is when it turns the Samsung screen off and on and won't go past it. I re-odin'd Tweaked plus cwm and fixed it.
stueycaster said:
I did something wrong. I installed init.d then copied 77tweaks and renice into the init.d file. I rebooted it once and it went fine. Then after i replaced the build.prop file with the down loaded one I restarted it and it went into boot loop. At least I guess that's what it is when it turns the Samsung screen off and on and won't go past it. I re-odin'd Tweaked plus cwm and fixed it.
Click to expand...
Click to collapse
Question for ya, what program are you using to replace the build.prop with?
Sent from my SCH-I510 using xda premium
crovax33 said:
Just installed with no issues and performed the required 2 reboots. The second reboot was three times faster than any other time I've rebooted. Is this a benefit of the tweaks?
Thanks for contributing to the community! I love that we still have active devs
Click to expand...
Click to collapse
Quite possibly...
Sent from my SCH-I510 using xda premium
dSlice said:
Question for ya, what program are you using to replace the build.prop with?
Sent from my SCH-I510 using xda premium
Click to expand...
Click to collapse
Root Explorer.
stueycaster said:
Root Explorer.
Click to expand...
Click to collapse
Hum. Did you mount the system as R/W? Also maybe try using Script Manager and see if that does anything.

[SCRIPT] Run init.d scripts once every N days [ZipAlign/SQLite3/others]

There are many ROMs that include the ZipAlign or SQLite3 vacuum on boot, but these command are not really needed to run on EVERY boot, once every few days can be enough, so I came out with this script.
To run it, you need to have busybox with the stat applet (should be there always), which gives information about a file, including last modification date.
This is done is by checking the last modification date on a file, which is touched or changed only when the main script is executed.
Currently I modified the ZipAlign and SQLite vacuum in my own rom to use this technique, and they seem to work fine. The monitored file is the log of the operation done, which is stored in the /data/ directory
ZipAlign on Boot:
Code:
#!/system/bin/sh
# Automatic ZipAlign by Wes Garner
# ZipAlign files in /data that have not been previously ZipAligned (using md5sum)
# Thanks to oknowton for the changes
# Changelog:
# 1.0 (11/30/09) Original
# 1.1 (12/01/09) Switched to zipalign -c 4 to check the apk instead of MD5 (oknowton)
# 1.2 (06/01/13) Run the main script only once every N days (default 7 days, 1 week) (mcbyte_it)
[COLOR="DarkRed"]LOG_FILE=/data/zipalign.log
#Interval between ZipAlign runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"] if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "Starting Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk | tee -a $LOG_FILE;
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
fi;
else
echo ZipAlign already completed on $apk | tee -a $LOG_FILE;
fi;
done;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/color]
[COLOR="DarkRed"]fi[/COLOR]
SQLite3 vacuum:
Code:
#!/system/bin/sh
# ========================================
# init.d script for McByte jkSGS3
# ========================================
# SQLite database vaccum
# Frequent inserts, updates, and deletes can cause the database file to become fragmented - where data for a single table or index is scattered around the database file.
# Running VACUUM ensures that each table and index is largely stored contiguously within the database file.
# In some cases, VACUUM may also reduce the number of partially filled pages in the database, reducing the size of the database file further.
# sqlite3 binary in /system/xbin is required!
# Changelog
# v1.0 - (??/??/????) - original version
# v1.1 - (06/01/2013) - run only every X seconds, default = 1 week (mcbyte_it)
#
[COLOR="DarkRed"]# Log file location
LOG_FILE=/data/sqlite.log
#Interval between SQLite3 runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"]if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "SQLite database VACUUM and REINDEX started at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for i in `busybox find /d* -iname "*.db"`; do
/system/xbin/sqlite3 $i 'VACUUM;';
resVac=$?
if [ $resVac == 0 ]; then
resVac="SUCCESS";
else
resVac="ERRCODE-$resVac";
fi;
/system/xbin/sqlite3 $i 'REINDEX;';
resIndex=$?
if [ $resIndex == 0 ]; then
resIndex="SUCCESS";
else
resIndex="ERRCODE-$resIndex";
fi;
echo "Database $i: VACUUM=$resVac REINDEX=$resIndex" | tee -a $LOG_FILE;
done
echo "SQLite database VACUUM and REINDEX finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/COLOR]
[COLOR="DarkRed"]fi;[/COLOR]
This looks like a great idea :good: is it possible to easily change the intended interval at which yo want the scripts to run though?
HTCDreamOn said:
This looks like a great idea :good: is it possible to easily change the intended interval at which yo want the scripts to run though?
Click to expand...
Click to collapse
Sure, check the examples I posted, they are well commented. Just change the value of the "RUN_EVERY".
I'll take a look
mcbyte_it said:
Sure, check the examples I posted, they are well commented. Just change the value of the "RUN_EVERY".
Click to expand...
Click to collapse
Awesome, I'll give them a go!
how can i modify this script to zimpalign /system/app too?
UnitedOceanic said:
how can i modify this script to zimpalign /system/app too?
Click to expand...
Click to collapse
There is no much sense of zipaligning system apps every x days, once they are zipaligned (when making the ROM zip), they remain zipaligned. some apks might need zip aligning if they get moved/installed as system apps after rom install.
Not to mention the stability, I don't know the exact boot mechanism of android, if you start zip aligning system apps during the init.d, it might cause instability to some system apps.
But if you mount the /system partition as read/write, do the zipaligning loop, then remount it as read-only, it should be possible.
still, I don't recommend doing so....
i pushed many apps from /data/app to /system/app.
I deleted the libs from the apks and copied them to /system/libs to saved space. however I forgot to zipalign the apks after removing the libs. I used the zipalign script from the rom toolbox app unfortunately it didn't work as expected. it just deleted the apps that should have been zipaligned.
I don't really want to zipalign /system at every boot. just once for the modified apks.
mcbyte_it said:
There are many ROMs that include the ZipAlign or SQLite3 vacuum on boot, but these command are not really needed to run on EVERY boot, once every few days can be enough, so I came out with this script.
To run it, you need to have busybox with the stat applet (should be there always), which gives information about a file, including last modification date.
This is done is by checking the last modification date on a file, which is touched or changed only when the main script is executed.
Currently I modified the ZipAlign and SQLite vacuum in my own rom to use this technique, and they seem to work fine. The monitored file is the log of the operation done, which is stored in the /data/ directory
ZipAlign on Boot:
Code:
#!/system/bin/sh
# Automatic ZipAlign by Wes Garner
# ZipAlign files in /data that have not been previously ZipAligned (using md5sum)
# Thanks to oknowton for the changes
# Changelog:
# 1.0 (11/30/09) Original
# 1.1 (12/01/09) Switched to zipalign -c 4 to check the apk instead of MD5 (oknowton)
# 1.2 (06/01/13) Run the main script only once every N days (default 7 days, 1 week) (mcbyte_it)
[COLOR="DarkRed"]LOG_FILE=/data/zipalign.log
#Interval between ZipAlign runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"] if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "Starting Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk | tee -a $LOG_FILE;
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
fi;
else
echo ZipAlign already completed on $apk | tee -a $LOG_FILE;
fi;
done;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/color]
[COLOR="DarkRed"]fi[/COLOR]
SQLite3 vacuum:
Code:
#!/system/bin/sh
# ========================================
# init.d script for McByte jkSGS3
# ========================================
# SQLite database vaccum
# Frequent inserts, updates, and deletes can cause the database file to become fragmented - where data for a single table or index is scattered around the database file.
# Running VACUUM ensures that each table and index is largely stored contiguously within the database file.
# In some cases, VACUUM may also reduce the number of partially filled pages in the database, reducing the size of the database file further.
# sqlite3 binary in /system/xbin is required!
# Changelog
# v1.0 - (??/??/????) - original version
# v1.1 - (06/01/2013) - run only every X seconds, default = 1 week (mcbyte_it)
#
[COLOR="DarkRed"]# Log file location
LOG_FILE=/data/sqlite.log
#Interval between SQLite3 runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"]if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "SQLite database VACUUM and REINDEX started at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for i in `busybox find /d* -iname "*.db"`; do
/system/xbin/sqlite3 $i 'VACUUM;';
resVac=$?
if [ $resVac == 0 ]; then
resVac="SUCCESS";
else
resVac="ERRCODE-$resVac";
fi;
/system/xbin/sqlite3 $i 'REINDEX;';
resIndex=$?
if [ $resIndex == 0 ]; then
resIndex="SUCCESS";
else
resIndex="ERRCODE-$resIndex";
fi;
echo "Database $i: VACUUM=$resVac REINDEX=$resIndex" | tee -a $LOG_FILE;
done
echo "SQLite database VACUUM and REINDEX finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/COLOR]
[COLOR="DarkRed"]fi;[/COLOR]
Click to expand...
Click to collapse
Thanks for this awesome script i was able to get an idea for this. I tried this two scripts but only zipalign works even though i have sqlite3 in stored in xbin.
mcbyte_it said:
There are many ROMs that include the ZipAlign or SQLite3 vacuum on boot, but these command are not really needed to run on EVERY boot, once every few days can be enough, so I came out with this script.
To run it, you need to have busybox with the stat applet (should be there always), which gives information about a file, including last modification date.
This is done is by checking the last modification date on a file, which is touched or changed only when the main script is executed.
Currently I modified the ZipAlign and SQLite vacuum in my own rom to use this technique, and they seem to work fine. The monitored file is the log of the operation done, which is stored in the /data/ directory
ZipAlign on Boot:
Code:
#!/system/bin/sh
# Automatic ZipAlign by Wes Garner
# ZipAlign files in /data that have not been previously ZipAligned (using md5sum)
# Thanks to oknowton for the changes
# Changelog:
# 1.0 (11/30/09) Original
# 1.1 (12/01/09) Switched to zipalign -c 4 to check the apk instead of MD5 (oknowton)
# 1.2 (06/01/13) Run the main script only once every N days (default 7 days, 1 week) (mcbyte_it)
[COLOR="DarkRed"]LOG_FILE=/data/zipalign.log
#Interval between ZipAlign runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"]if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "Starting Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk | tee -a $LOG_FILE;
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
fi;
else
echo ZipAlign already completed on $apk | tee -a $LOG_FILE;
fi;
done;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/color]
[COLOR="DarkRed"]fi[/COLOR]
SQLite3 vacuum:
Code:
#!/system/bin/sh
# ========================================
# init.d script for McByte jkSGS3
# ========================================
# SQLite database vaccum
# Frequent inserts, updates, and deletes can cause the database file to become fragmented - where data for a single table or index is scattered around the database file.
# Running VACUUM ensures that each table and index is largely stored contiguously within the database file.
# In some cases, VACUUM may also reduce the number of partially filled pages in the database, reducing the size of the database file further.
# sqlite3 binary in /system/xbin is required!
# Changelog
# v1.0 - (??/??/????) - original version
# v1.1 - (06/01/2013) - run only every X seconds, default = 1 week (mcbyte_it)
#
[COLOR="DarkRed"]# Log file location
LOG_FILE=/data/sqlite.log
#Interval between SQLite3 runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"]if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "SQLite database VACUUM and REINDEX started at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for i in `busybox find /d* -iname "*.db"`; do
/system/xbin/sqlite3 $i 'VACUUM;';
resVac=$?
if [ $resVac == 0 ]; then
resVac="SUCCESS";
else
resVac="ERRCODE-$resVac";
fi;
/system/xbin/sqlite3 $i 'REINDEX;';
resIndex=$?
if [ $resIndex == 0 ]; then
resIndex="SUCCESS";
else
resIndex="ERRCODE-$resIndex";
fi;
echo "Database $i: VACUUM=$resVac REINDEX=$resIndex" | tee -a $LOG_FILE;
done
echo "SQLite database VACUUM and REINDEX finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/COLOR]
[COLOR="DarkRed"]fi;[/COLOR]
Click to expand...
Click to collapse
Hi guys! I recently installed lollipop touch wiz and installed the two scripts on the Op, managed to get the sql script to work fine but when the zip align tries to run it errors out in the log, any advice to what I've done wrong or if you guys know of a change in lollipop that doesn't play nice with zip aligning?
Starting Automatic ZipAlign 06-04-2014 15:23:01
ZipAligning *.apk
ZipAligning *.apk Failed
Automatic ZipAlign finished at 06-04-2014 15:23:01
Click to expand...
Click to collapse
All I've done as far as modify the script is I got rid of the color tags.
Also the sql log shows the correct date as well, where this script does not.
Thank you in advance guys!
Any chance to make this flasheable thx!
how to make an specific init.d script runs every x minutes?
and when unlock the screen

[MOD][REF]Set governer on boot with init.d

Since everyones asking how to set a governor on boot, heres a sample of my init.d script that sets "on demand" with max frequency 1400000 (1.4GHZ) and min frequency 200000 (0.2GHZ) on boot, if you would like to use it or modify it let me know, i dont bite and im one to help! enjoy!!
here's the guidelines!
100000 = 1GHZ
DOWNLOAD
This is my Script to set / tweak my Governor on my XZ.
It's easy to handle, i guess.
#!/system/bin/sh
LOG_FILE=/data/Init.d_Tweaks.log
sleep 60
# Set Scaling Governor
GOVERNOR="conservative"
echo $GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $GOVERNOR > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo $GOVERNOR > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo $GOVERNOR > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo "$GOVERNOR Governor is running" | tee -a $LOG_FILE;
# Set Min & Max Frequency
# 384000 486000 594000 702000 810000 918000 1026000 1134000 1242000 1350000 1458000 1512000
CPU_MIN="384000"
CPU_MAX="1242000"
echo $CPU_MIN > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $CPU_MIN > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo $CPU_MIN > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo $CPU_MIN > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
echo "Min / Max Frequency is set to $CPU_MIN / $CPU_MAX" | tee -a $LOG_FILE;
# Set IO Sheduler
SHEDULER="deadline"
echo $SHEDULER > /sys/block/mmcblk0/queue/scheduler
echo $SHEDULER > /sys/block/mmcblk1/queue/scheduler
echo "$SHEDULER Sheduler is running" | tee -a $LOG_FILE;
# Set SD Cache
READ_AHEAD_KB="512"
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/254:0/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/254:1/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/179:32/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/0:18/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:0/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:1/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:2/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:3/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:4/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:5/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:6/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:7/read_ahead_kb
echo "256" > /sys/devices/virtual/bdi/default/read_ahead_kb
echo "SD Cache is set to $READ_AHEAD_KB kb" | tee -a $LOG_FILE;
# Tweak Governor
# Ondemand
if [ -d "/sys/devices/system/cpu/cpufreq/$GOVERNOR" ]; then
# Ondemand Tweaked
echo "90" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
echo "75000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo "2" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo "384000" > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
echo "1242000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
echo "10" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
echo "35" > /sys/devices/system/cpu/cpufreq/ondemand/freq_step
# Ondemand Battery
# echo "95" /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
# echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
# echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
# echo "120000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
# echo "1" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
# echo "384000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "1026000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "5" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
# echo "10" > /sys/devices/system/cpu/cpufreq/ondemand/freq_step
# Ondemand Performance
# echo "70" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
# echo "60" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
# echo "60" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
# echo "50000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
# echo "2" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
# echo "702000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "1512000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "15" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
# echo "50" > /sys/devices/system/cpu/cpufreq/ondemand/freq_step
fi;
# Interactive
if [ -d "/sys/devices/system/cpu/cpufreq/$GOVERNOR" ]; then
# Interactive Tweaked
echo "90" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo "1242000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo "20000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo "30000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
# Interactive Battery
# echo "95" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
# echo "1026000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
# echo "10000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
# echo "40000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
# Interactive Performance
# echo "80" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
# echo "1512000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
# echo "40000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
# echo "20000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
fi;
# Conservative
if [ -d "/sys/devices/system/cpu/cpufreq/$GOVERNOR" ]; then
# Conservative Tweaked
echo "90" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold
echo "60000" > /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
echo "3" > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor
echo "30" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
echo "15" > /sys/devices/system/cpu/cpufreq/conservative/freq_step
# Conservative Battery
# echo "95" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold
# echo "120000" > /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
# echo "1" > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor
# echo "40" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
# echo "10" > /sys/devices/system/cpu/cpufreq/conservative/freq_step
# Conservative Performance
# echo "60" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold
# echo "40000" > /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
# echo "5" > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor
# echo "20" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
# echo "25" > /sys/devices/system/cpu/cpufreq/conservative/freq_step
fi;
echo "$GOVERNOR Governor is Tweaked" | tee -a $LOG_FILE;
# Custom Kernel Tweaks
# reduce / increase [mv] for all Frequencys
# echo "-90000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
# Set GPU Governor
# echo "simple" > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
# Set GPU Clock
# echo "325000000" > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk
# Swap / Tap 2 Wake
# echo "0" > /sys/android_touch/doubletap2wake
# echo "0" > /sys/android_touch/sweep2wake
# echo "Custom Kernel Settings are applied" | tee -a $LOG_FILE;
echo " " | tee -a $LOG_FILE;
echo "@ $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
echo " " | tee -a $LOG_FILE;
Gesendet von meinem C6603 mit Tapatalk
HSD-Pilot said:
This is my Script to set / tweak my Governor on my XZ.
It's easy to handle, i guess.
#!/system/bin/sh
LOG_FILE=/data/Init.d_Tweaks.log
sleep 60
# Set Scaling Governor
GOVERNOR="conservative"
echo $GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $GOVERNOR > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo $GOVERNOR > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo $GOVERNOR > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo "$GOVERNOR Governor is running" | tee -a $LOG_FILE;
# Set Min & Max Frequency
# 384000 486000 594000 702000 810000 918000 1026000 1134000 1242000 1350000 1458000 1512000
CPU_MIN="384000"
CPU_MAX="1242000"
echo $CPU_MIN > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $CPU_MIN > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo $CPU_MIN > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo $CPU_MIN > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
echo "Min / Max Frequency is set to $CPU_MIN / $CPU_MAX" | tee -a $LOG_FILE;
# Set IO Sheduler
SHEDULER="deadline"
echo $SHEDULER > /sys/block/mmcblk0/queue/scheduler
echo $SHEDULER > /sys/block/mmcblk1/queue/scheduler
echo "$SHEDULER Sheduler is running" | tee -a $LOG_FILE;
# Set SD Cache
READ_AHEAD_KB="512"
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/254:0/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/254:1/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/179:32/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/0:18/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:0/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:1/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:2/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:3/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:4/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:5/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:6/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:7/read_ahead_kb
echo "256" > /sys/devices/virtual/bdi/default/read_ahead_kb
echo "SD Cache is set to $READ_AHEAD_KB kb" | tee -a $LOG_FILE;
# Tweak Governor
# Ondemand
if [ -d "/sys/devices/system/cpu/cpufreq/$GOVERNOR" ]; then
# Ondemand Tweaked
echo "90" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
echo "75000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo "2" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo "384000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
echo "1242000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
echo "10" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
echo "35" > /sys/devices/system/cpu/cpufreq/ondemand/freq_step
# Ondemand Battery
# echo "95" /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
# echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
# echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
# echo "120000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
# echo "1" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
# echo "384000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "1026000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "5" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
# echo "10" > /sys/devices/system/cpu/cpufreq/ondemand/freq_step
# Ondemand Performance
# echo "70" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
# echo "60" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
# echo "60" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
# echo "50000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
# echo "2" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
# echo "702000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "1512000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "15" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
# echo "50" > /sys/devices/system/cpu/cpufreq/ondemand/freq_step
fi;
# Interactive
if [ -d "/sys/devices/system/cpu/cpufreq/$GOVERNOR" ]; then
# Interactive Tweaked
echo "90" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo "1242000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo "20000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo "30000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
# Interactive Battery
# echo "95" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
# echo "1026000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
# echo "10000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
# echo "40000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
# Interactive Performance
# echo "80" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
# echo "1512000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
# echo "40000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
# echo "20000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
fi;
# Conservative
if [ -d "/sys/devices/system/cpu/cpufreq/$GOVERNOR" ]; then
# Conservative Tweaked
echo "90" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold
echo "60000" > /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
echo "3" > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor
echo "30" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
echo "15" > /sys/devices/system/cpu/cpufreq/conservative/freq_step
# Conservative Battery
# echo "95" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold
# echo "120000" > /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
# echo "1" > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor
# echo "40" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
# echo "10" > /sys/devices/system/cpu/cpufreq/conservative/freq_step
# Conservative Performance
# echo "60" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold
# echo "40000" > /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
# echo "5" > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor
# echo "20" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
# echo "25" > /sys/devices/system/cpu/cpufreq/conservative/freq_step
fi;
echo "$GOVERNOR Governor is Tweaked" | tee -a $LOG_FILE;
# Custom Kernel Tweaks
# reduce / increase [mv] for all Frequencys
# echo "-90000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
# Set GPU Governor
# echo "simple" > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
# Set GPU Clock
# echo "325000000" > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk
# Swap / Tap 2 Wake
# echo "0" > /sys/android_touch/doubletap2wake
# echo "0" > /sys/android_touch/sweep2wake
# echo "Custom Kernel Settings are applied" | tee -a $LOG_FILE;
echo " " | tee -a $LOG_FILE;
echo "@ $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
echo " " | tee -a $LOG_FILE;
Gesendet von meinem C6603 mit Tapatalk
Click to expand...
Click to collapse
thats pretty neat, mines just a basic compared to yours
HSD-Pilot said:
This is my Script to set / tweak my Governor on my XZ.
...
Click to expand...
Click to collapse
do i only have to change ondemand to hotplug to work on hotplug governor?
Maximus1a said:
do i only have to change ondemand to hotplug to work on hotplug governor?
Click to expand...
Click to collapse
If your Kernel supports it, sure.
You can set any available Governor on your Phone.
Just edit
GOVERNOR="hotplug"
To tweak it, just search the Forum for available Values. My Phone doesn't support it, that's why it's not in the script.
Gesendet von meinem Full Android on C6603 mit Tapatalk 2
HSD-Pilot said:
This is my Script to set / tweak my Governor on my XZ.
It's easy to handle, i guess.
#!/system/bin/sh
LOG_FILE=/data/Init.d_Tweaks.log
sleep 60
# Set Scaling Governor
GOVERNOR="conservative"
echo $GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $GOVERNOR > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo $GOVERNOR > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo $GOVERNOR > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo "$GOVERNOR Governor is running" | tee -a $LOG_FILE;
# Set Min & Max Frequency
# 384000 486000 594000 702000 810000 918000 1026000 1134000 1242000 1350000 1458000 1512000
CPU_MIN="384000"
CPU_MAX="1242000"
echo $CPU_MIN > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $CPU_MIN > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo $CPU_MIN > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo $CPU_MIN > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
echo $CPU_MAX > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
echo "Min / Max Frequency is set to $CPU_MIN / $CPU_MAX" | tee -a $LOG_FILE;
# Set IO Sheduler
SHEDULER="deadline"
echo $SHEDULER > /sys/block/mmcblk0/queue/scheduler
echo $SHEDULER > /sys/block/mmcblk1/queue/scheduler
echo "$SHEDULER Sheduler is running" | tee -a $LOG_FILE;
# Set SD Cache
READ_AHEAD_KB="512"
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/254:0/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/254:1/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/179:32/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/0:18/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:0/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:1/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:2/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:3/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:4/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:5/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:6/read_ahead_kb
echo $READ_AHEAD_KB > /sys/devices/virtual/bdi/7:7/read_ahead_kb
echo "256" > /sys/devices/virtual/bdi/default/read_ahead_kb
echo "SD Cache is set to $READ_AHEAD_KB kb" | tee -a $LOG_FILE;
# Tweak Governor
# Ondemand
if [ -d "/sys/devices/system/cpu/cpufreq/$GOVERNOR" ]; then
# Ondemand Tweaked
echo "90" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
echo "75000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo "2" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo "384000" > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
echo "1242000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
echo "10" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
echo "35" > /sys/devices/system/cpu/cpufreq/ondemand/freq_step
# Ondemand Battery
# echo "95" /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
# echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
# echo "85" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
# echo "120000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
# echo "1" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
# echo "384000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "1026000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "5" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
# echo "10" > /sys/devices/system/cpu/cpufreq/ondemand/freq_step
# Ondemand Performance
# echo "70" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
# echo "60" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
# echo "60" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
# echo "50000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
# echo "2" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
# echo "702000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "1512000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
# echo "15" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
# echo "50" > /sys/devices/system/cpu/cpufreq/ondemand/freq_step
fi;
# Interactive
if [ -d "/sys/devices/system/cpu/cpufreq/$GOVERNOR" ]; then
# Interactive Tweaked
echo "90" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo "1242000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo "20000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo "30000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
# Interactive Battery
# echo "95" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
# echo "1026000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
# echo "10000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
# echo "40000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
# Interactive Performance
# echo "80" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
# echo "1512000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
# echo "40000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
# echo "20000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
fi;
# Conservative
if [ -d "/sys/devices/system/cpu/cpufreq/$GOVERNOR" ]; then
# Conservative Tweaked
echo "90" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold
echo "60000" > /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
echo "3" > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor
echo "30" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
echo "15" > /sys/devices/system/cpu/cpufreq/conservative/freq_step
# Conservative Battery
# echo "95" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold
# echo "120000" > /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
# echo "1" > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor
# echo "40" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
# echo "10" > /sys/devices/system/cpu/cpufreq/conservative/freq_step
# Conservative Performance
# echo "60" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold
# echo "40000" > /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
# echo "5" > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor
# echo "20" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
# echo "25" > /sys/devices/system/cpu/cpufreq/conservative/freq_step
fi;
echo "$GOVERNOR Governor is Tweaked" | tee -a $LOG_FILE;
# Custom Kernel Tweaks
# reduce / increase [mv] for all Frequencys
# echo "-90000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
# Set GPU Governor
# echo "simple" > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor
# Set GPU Clock
# echo "325000000" > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk
# Swap / Tap 2 Wake
# echo "0" > /sys/android_touch/doubletap2wake
# echo "0" > /sys/android_touch/sweep2wake
# echo "Custom Kernel Settings are applied" | tee -a $LOG_FILE;
echo " " | tee -a $LOG_FILE;
echo "@ $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
echo " " | tee -a $LOG_FILE;
Gesendet von meinem C6603 mit Tapatalk
Click to expand...
Click to collapse
How to set minimum gpu frequency? Will this work?:
# echo "325000000" > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/min_gpuclk
:good:
@Ricky Divjakovski
Sorry for disturbing
Please give the script in the post or give a mirror link sir..
All your threads are very helpful
Thanks

[SCRIPT][UPDATED 03.26.14] Fix Lag, Defrag/Free Memory with |=>TrimDropOff<=|

Updated 03.26.14 - Released v2.1 - bug fixes and code cleaned
Introduction:
I am by no means a developer. I am just an android enthusiast who has learned a bit of bash. The reason I made this script was that settings>>wifi>>advanced was not promptly turning wifi off when my device would sleep; sometimes it would not turn off at all. So I figured since I am making a script to resolve this issue I might as well add a couple of other functions as well. To this end I noticed some people saying THIS APP was helpful and I missed the Flush-O-Matic script from V6 SuperCharger so I added fstrim and drop_caches=3 to the script.
Click to expand...
Click to collapse
What will this do?
The script will allow you to sync wifi, fstrim, and/or drop_caches=3 with sleep and/or it will allow you to schedule fstrim and/or drop_caches=3 using crond. The scheduling option can work on either a hourly (you can choose to run desired programs every hour on the hour, every two hours on the hour, every 3 hours on the hour, etc) or daily basis (you can choose to run desired programs at a given time on the hour).
Both the sync and schedule options will load themselves in to memory each boot and each time your device goes to sleep and/or when scheduled the scripts will depending on your options: (1) sync your data so as to ensure no data is lost; (2) TRIM your /system, /data, and /cache partitions; (3) DROP CACHES = 3; and (4) turn off wifi.
In addition, there is also an on-the-fly script to manually trim partitions and drop caches when desired.
Click to expand...
Click to collapse
Benefits:
Reduce lag/improve i/o efficiency (see THIS and THIS).
Although android automatically invokes fstrim when certain conditions are met, these criteria could seldom if ever be met depending upon your usage style. The init.d script should ensure fstrim is invoked more frequently for most users.
Should use less ram than apps that perform similar functions (I say should because I have never used such apps, but I imagine they consume more that .2-.5 mb of ram).
Click to expand...
Click to collapse
Requirements:
root
init.d
busybox
fstrim (should be in all nexus 4.3+ roms)
Click to expand...
Click to collapse
Warning/Disclaimer:
Although these scripts function as intended on my device – Nexus 7 (2013), SlimKat (weekly), ElementalX...Use at your own risk. Neither I nor XDA are responsible for any possible deleterious effects.
Click to expand...
Click to collapse
Known Issues/Bugs:
If you use the sync option, scripts with a lower priority than Z99 will not execute.
The log files don't always display as intended...dunno why...any help/suggestions would be appreciated.
Let me know if you find any others .
Click to expand...
Click to collapse
Install, Usage/Verification, & Uninstall:
Install -
Note: If you use crond for other tasks, both the install and uninstall routine account for this potential contigency and should leave your other crond tasks uneffects.
make a nandroid backup
download the zip (<<NOT flashable) attached to this post
extract the zip’s contents
if you were/are using the first version of this script manually delete: /etc/init.d/07TrimDropOff, /data/TrimDropOff_Awake.log, and /data/TrimDropOff_Sleep.log
run TrimDropOffInstaller with superuser permission via terminal or script manager.
follow the scripts prompts
reboot
enjoy
Usage/Verification -
Assuming you have followed the install procedure, next, put your device to sleep and then wake it if you are using the sync option.
Now check the various logs in /data/TrimDropOff. The logs will show the time, the script’s PIDs, the path of the PIDs (just to double-check the PIDs are correct), the ram used by the PIDs, action(s) preformed (amount trimmed from each partition and/or if drop_cahes was run), or errors.
If you want verify manually via terminal do [pgrep -f TrimDrop] for the sync option or [pgrep crond] for the scheduling option to get the PIDs, do [cat /proc/PID/cmdline] for each PID to verify it truly belongs to Z99TrimDropOff or crond, and do [dumpsys meminfo | grep PID] for each PID to verify ram usage (this command will yield duplicates, which can be disregarded and may output undesired additional results, which can be filtered by looking through the results for the relevant PID).
To use the on-the-fly script to trim and/or drop as desired, in terminal do [su -c trimdrop].
Should you want to reconfigure your setup, uninstall before reinstalling to avoid potential issues.
Uninstall -
Note: If you use crond for other tasks, both the install and uninstall routine account for this potential contigency and should leave your other crond tasks uneffects.
Rerun TrimDropOffInstaller with superuser permission and use uninstall option at the beginning of the script.
Reboot and all will be back to as it was before.
Click to expand...
Click to collapse
To-Do List:
Make in to an AROMA package.
I don't know, you tell me .
Click to expand...
Click to collapse
Code:
#!/system/bin/sh
# This script was authored by Defiant07 @ xda. Feel free to use it as you see fit, but please give proper credits.
# Big thanks to zeppelinrox, dk_zero-cool, & gu5t3r @ xda for their contributions to portions of this script (see the code of my other script SwapItOn @ xda for detailed citations).
# Read Karl Marx.
input_error(){
echo "That is not a valid input...try again...bye ."
exit 69
}
mount_rw(){
mount -o remount,rw / 2>/dev/null
mount -o remount,rw rootfs 2>/dev/null
busybox mount -o remount,rw / 2>/dev/null
busybox mount -o remount,rw rootfs 2>/dev/null
mount -o remount,rw /system 2>/dev/null
busybox mount -o remount,rw /system 2>/dev/null
busybox mount -o remount,rw $(busybox mount | awk '/system /{print $1,$3}') 2>/dev/null
}
mount_ro(){
mount -o remount,ro / 2>/dev/null
mount -o remount,ro rootfs 2>/dev/null
busybox mount -o remount,ro / 2>/dev/null
busybox mount -o remount,ro rootfs 2>/dev/null
mount -o remount,ro /system 2>/dev/null
busybox mount -o remount,ro /system 2>/dev/null
busybox mount -o remount,ro $(busybox mount | awk '/system /{print $1,$3}') 2>/dev/null
}
clear
if [ ! "`busybox`" ]; then
echo "Missing busybox...try again...bye ."
exit 69
fi
id=$(id); id=${id#*=}; id=${id%%[\( ]*}
if [ "$id" = "0" ] || [ "$id" = "root" ]; then
echo "" 1>/dev/null
else
echo "Not running as root...try again...bye ."
exit 69
fi
if [ ! -d /etc/init.d ]; then
echo "Missing /etc/init.d...try again...bye ."
exit 69
fi
if [ ! "`grep -r fstrim /system/bin`" ] && [ ! "`grep -r fstrim /system/xbin`" ]; then
echo "Missing fstrim...try again...bye ."
exit 69
fi
echo "Do you want to install or uninstall TrimDropOff?"
echo "Note: If you are rerunning this script to"
echo "reconfigure your setup, uninstall first."
echo -n "Input (i)nstall or (u)ninstall: "
read install_uninstall
echo
case $install_uninstall in
i|I)mount_rw
if [ ! -d "/sqlite_stmt_journals" ]; then
mkdir /sqlite_stmt_journals
fi
if [ ! -d "/data/TrimDropOff" ]; then
mkdir /data/TrimDropOff
chmod 755 /data/TrimDropOff
fi;;
u|U)mount_rw
rm /system/etc/init.d/Z99TrimDropOff_Sync 2>/dev/null
rm /system/etc/init.d/07TrimDropOff_Cron 2>/dev/null
rm /system/xbin/trimdrop 2>/dev/null
rm -rf /data/TrimDropOff 2>/dev/null
echo "Are you using cron.d for any other services?"
echo -n "Input es or o: "
read crond_use
echo
case $crond_use in
y|Y)sed '/TrimDropOff/d' -i /system/etc/cron.d/crontabs/root 2>/dev/null;;
n|N)rm -rf /system/etc/cron.d 2>/dev/null;;
*)input_error;;
esac
mount_ro
echo "All done. You can close your app now."
echo "Reboot your device to stop all processes."
exit 0;;
*)input_error;;
esac
wifi_only(){
cat > /system/etc/init.d/Z99TrimDropOff_Sync << EOF
#!/system/bin/sh
tdo_time(){
while [ ! "\`ps | grep -m 1 [a]ndroid\`" ]; do sleep 10; done
while [ 1 ]; do
AWAKE=\`cat /sys/power/wait_for_fb_wake\`
if [ "\$AWAKE" = "awake" ]; then
exec 1>/data/TrimDropOff/Awake.log
svc wifi enable
echo "\$(date +"%r %Y.%m.%d"): Waiting for screen to sleep. Confirming script in memory..."
echo "PIDs:"
pgrep -f TrimDrop
pidls=\`pgrep -f TrimDrop\`
echo "Verify Correct PIDs:"
for i in \$pidls; do
cat /proc/\$i/cmdline
done
echo ""
echo "RAM Usage:"
for i in \$pidls; do
dumpsys meminfo | grep \$i | grep sh | grep -m 1 pid
done
fi
SLEEPING=\`cat /sys/power/wait_for_fb_sleep\`
if [ "\$SLEEPING" = "sleeping" ]; then
exec 1>/data/TrimDropOff/Sleep.log
echo "\$(date +"%r %Y.%m.%d"): Offing."
svc wifi disable
fi
done
}
if [ "\`ps | grep -m 1 [a]ndroid\`" ]; then tdo_time
else exec > /data/TrimDropOff/Sync_BootErrors.log 2>&1
tdo_time &
fi
exit 0
EOF
}
fstrim_only(){
cat > /system/etc/init.d/Z99TrimDropOff_Sync << EOF
#!/system/bin/sh
tdo_time(){
while [ ! "\`ps | grep -m 1 [a]ndroid\`" ]; do sleep 10; done
while [ 1 ]; do
AWAKE=\`cat /sys/power/wait_for_fb_wake\`
if [ "\$AWAKE" = "awake" ]; then
exec 1>/data/TrimDropOff/Awake.log
echo "\$(date +"%r %Y.%m.%d"): Waiting for screen to sleep. Confirming script in memory..."
echo "PIDs:"
pgrep -f TrimDrop
pidls=\`pgrep -f TrimDrop\`
echo "Verify Correct PIDs:"
for i in \$pidls; do
cat /proc/\$i/cmdline
done
echo ""
echo "RAM Usage:"
for i in \$pidls; do
dumpsys meminfo | grep \$i | grep sh | grep -m 1 pid
done
fi
SLEEPING=\`cat /sys/power/wait_for_fb_sleep\`
if [ "\$SLEEPING" = "sleeping" ]; then
exec 1>/data/TrimDropOff/Sleep.log
echo "\$(date +"%r %Y.%m.%d"): Trimming."
echo "/system:"
busybox sync
fstrim -v /system
echo "/data:"
busybox sync
fstrim -v /data
echo "/cache:"
busybox sync
fstrim -v /cache
fi
done
}
if [ "\`ps | grep -m 1 [a]ndroid\`" ]; then tdo_time
else exec > /data/TrimDropOff/Sync_BootErrors.log 2>&1
tdo_time &
fi
exit 0
EOF
}
drop_only(){
cat > /system/etc/init.d/Z99TrimDropOff_Sync << EOF
#!/system/bin/sh
tdo_time(){
while [ ! "\`ps | grep -m 1 [a]ndroid\`" ]; do sleep 10; done
while [ 1 ]; do
AWAKE=\`cat /sys/power/wait_for_fb_wake\`
if [ "\$AWAKE" = "awake" ]; then
exec 1>/data/TrimDropOff/Awake.log
echo "\$(date +"%r %Y.%m.%d"): Waiting for screen to sleep. Confirming script in memory..."
echo "PIDs:"
pgrep -f TrimDrop
pidls=\`pgrep -f TrimDrop\`
echo "Verify Correct PIDs:"
for i in \$pidls; do
cat /proc/\$i/cmdline
done
echo ""
echo "RAM Usage:"
for i in \$pidls; do
dumpsys meminfo | grep \$i | grep sh | grep -m 1 pid
done
fi
SLEEPING=\`cat /sys/power/wait_for_fb_sleep\`
if [ "\$SLEEPING" = "sleeping" ]; then
exec 1>/data/TrimDropOff/Sleep.log
echo "\$(date +"%r %Y.%m.%d"): Dropping."
echo "drop caches:"
busybox sync
busybox sysctl -w vm.drop_caches=3
fi
done
}
if [ "\`ps | grep -m 1 [a]ndroid\`" ]; then tdo_time
else exec > /data/TrimDropOff/Sync_BootErrors.log 2>&1
tdo_time &
fi
exit 0
EOF
}
wifi_fstrim(){
cat > /system/etc/init.d/Z99TrimDropOff_Sync << EOF
#!/system/bin/sh
tdo_time(){
while [ ! "\`ps | grep -m 1 [a]ndroid\`" ]; do sleep 10; done
while [ 1 ]; do
AWAKE=\`cat /sys/power/wait_for_fb_wake\`
if [ "\$AWAKE" = "awake" ]; then
exec 1>/data/TrimDropOff/Awake.log
svc wifi enable
echo "\$(date +"%r %Y.%m.%d"): Waiting for screen to sleep. Confirming script in memory..."
echo "PIDs:"
pgrep -f TrimDrop
pidls=\`pgrep -f TrimDrop\`
echo "Verify Correct PIDs:"
for i in \$pidls; do
cat /proc/\$i/cmdline
done
echo ""
echo "RAM Usage:"
for i in \$pidls; do
dumpsys meminfo | grep \$i | grep sh | grep -m 1 pid
done
fi
SLEEPING=\`cat /sys/power/wait_for_fb_sleep\`
if [ "\$SLEEPING" = "sleeping" ]; then
exec 1>/data/TrimDropOff/Sleep.log
echo "\$(date +"%r %Y.%m.%d"): Trimming, Offing."
echo "/system:"
busybox sync
fstrim -v /system
echo "/data:"
busybox sync
fstrim -v /data
echo "/cache:"
busybox sync
fstrim -v /cache
svc wifi disable
fi
done
}
if [ "\`ps | grep -m 1 [a]ndroid\`" ]; then tdo_time
else exec > /data/TrimDropOff/Sync_BootErrors.log 2>&1
tdo_time &
fi
exit 0
EOF
}
wifi_drop(){
cat > /system/etc/init.d/Z99TrimDropOff_Sync << EOF
#!/system/bin/sh
tdo_time(){
while [ ! "\`ps | grep -m 1 [a]ndroid\`" ]; do sleep 10; done
while [ 1 ]; do
AWAKE=\`cat /sys/power/wait_for_fb_wake\`
if [ "\$AWAKE" = "awake" ]; then
exec 1>/data/TrimDropOff/Awake.log
svc wifi enable
echo "\$(date +"%r %Y.%m.%d"): Waiting for screen to sleep. Confirming script in memory..."
echo "PIDs:"
pgrep -f TrimDrop
pidls=\`pgrep -f TrimDrop\`
echo "Verify Correct PIDs:"
for i in \$pidls; do
cat /proc/\$i/cmdline
done
echo ""
echo "RAM Usage:"
for i in \$pidls; do
dumpsys meminfo | grep \$i | grep sh | grep -m 1 pid
done
fi
SLEEPING=\`cat /sys/power/wait_for_fb_sleep\`
if [ "\$SLEEPING" = "sleeping" ]; then
exec 1>/data/TrimDropOff/Sleep.log
echo "\$(date +"%r %Y.%m.%d"): Dropping, Offing."
echo "drop caches:"
busybox sync
busybox sysctl -w vm.drop_caches=3
svc wifi disable
fi
done
}
if [ "\`ps | grep -m 1 [a]ndroid\`" ]; then tdo_time
else exec > /data/TrimDropOff/Sync_BootErrors.log 2>&1
tdo_time &
fi
exit 0
EOF
}
fstrim_drop(){
cat > /system/etc/init.d/Z99TrimDropOff_Sync << EOF
#!/system/bin/sh
tdo_time(){
while [ ! "\`ps | grep -m 1 [a]ndroid\`" ]; do sleep 10; done
while [ 1 ]; do
AWAKE=\`cat /sys/power/wait_for_fb_wake\`
if [ "\$AWAKE" = "awake" ]; then
exec 1>/data/TrimDropOff/Awake.log
echo "\$(date +"%r %Y.%m.%d"): Waiting for screen to sleep. Confirming script in memory..."
echo "PIDs:"
pgrep -f TrimDrop
pidls=\`pgrep -f TrimDrop\`
echo "Verify Correct PIDs:"
for i in \$pidls; do
cat /proc/\$i/cmdline
done
echo ""
echo "RAM Usage:"
for i in \$pidls; do
dumpsys meminfo | grep \$i | grep sh | grep -m 1 pid
done
fi
SLEEPING=\`cat /sys/power/wait_for_fb_sleep\`
if [ "\$SLEEPING" = "sleeping" ]; then
exec 1>/data/TrimDropOff/Sleep.log
echo "\$(date +"%r %Y.%m.%d"): Trimming, Dropping."
echo "/system:"
busybox sync
fstrim -v /system
echo "/data:"
busybox sync
fstrim -v /data
echo "/cache:"
busybox sync
fstrim -v /cache
echo "drop caches:"
busybox sync
busybox sysctl -w vm.drop_caches=3
fi
done
}
if [ "\`ps | grep -m 1 [a]ndroid\`" ]; then tdo_time
else exec > /data/TrimDropOff/Sync_BootErrors.log 2>&1
tdo_time &
fi
exit 0
EOF
}
wifi_fstrim_drop(){
cat > /system/etc/init.d/Z99TrimDropOff_Sync << EOF
#!/system/bin/sh
tdo_time(){
while [ ! "\`ps | grep -m 1 [a]ndroid\`" ]; do sleep 10; done
while [ 1 ]; do
AWAKE=\`cat /sys/power/wait_for_fb_wake\`
if [ "\$AWAKE" = "awake" ]; then
exec 1>/data/TrimDropOff/Awake.log
svc wifi enable
echo "\$(date +"%r %Y.%m.%d"): Waiting for screen to sleep. Confirming script in memory..."
echo "PIDs:"
pgrep -f TrimDrop
pidls=\`pgrep -f TrimDrop\`
echo "Verify Correct PIDs:"
for i in \$pidls; do
cat /proc/\$i/cmdline
done
echo ""
echo "RAM Usage:"
for i in \$pidls; do
dumpsys meminfo | grep \$i | grep sh | grep -m 1 pid
done
fi
SLEEPING=\`cat /sys/power/wait_for_fb_sleep\`
if [ "\$SLEEPING" = "sleeping" ]; then
exec 1>/data/TrimDropOff/Sleep.log
echo "\$(date +"%r %Y.%m.%d"): Trimming, Dropping, Offing."
echo "/system:"
busybox sync
fstrim -v /system
echo "/data:"
busybox sync
fstrim -v /data
echo "/cache:"
busybox sync
fstrim -v /cache
echo "drop caches:"
busybox sync
busybox sysctl -w vm.drop_caches=3
svc wifi disable
fi
done
}
if [ "\`ps | grep -m 1 [a]ndroid\`" ]; then tdo_time
else exec > /data/TrimDropOff/Sync_BootErrors.log 2>&1
tdo_time &
fi
exit 0
EOF
}
echo "Do you want to sync fstrim, drop_caches=3, and/or"
echo "wifi with sleep?"
echo "WARNING: This will cause init.d scripts with a"
echo "priority lower than Z99 to NOT execute."
echo -n "Input es or o: "
read TDOsync
echo
case $TDOsync in
y|Y)echo "Which function(s) would you like to sync with sleep?"
echo "Input 1 for wifi only, 2 for fstrim only,"
echo "3 for drop_caches only, 4 for wifi and fstrim"
echo "5 for wifi and drop, 6 for fstrim and drop, or"
echo -n "7 for all: "
read sync_opt
echo
case $sync_opt in
1)wifi_only;;
2)fstrim_only;;
3)drop_only;;
4)wifi_fstrim;;
5)wifi_drop;;
6)fsrim_drop;;
7)wifi_fstrim_drop;;
*)input_error;;
esac
chmod 755 /system/etc/init.d/Z99TrimDropOff_Sync;;
n|N);;
*)input_error;;
esac
only_fstrim(){
cat > /data/TrimDropOff/TrimDropOff_Cron << EOF
#!/system/bin/sh
# This script was authored by Defiant07 @ xda. Feel free to use it as you see fit, but please give proper credits.
# Read Karl Marx.
exec 1>/data/TrimDropOff/CronRan.log
echo "\$(date +"%r %Y.%m.%d"): Trimming."
echo "/system:"
busybox sync
fstrim -v /system
echo "/data:"
busybox sync
fstrim -v /data
echo "/cache:"
busybox sync
fstrim -v /cache
exit 0
EOF
}
only_drop(){
cat > /data/TrimDropOff/TrimDropOff_Cron << EOF
#!/system/bin/sh
# This script was authored by Defiant07 @ xda. Feel free to use it as you see fit, but please give proper credits.
# Read Karl Marx.
exec 1>/data/TrimDropOff/CronRan.log
echo "\$(date +"%r %Y.%m.%d"): Dropping."
echo "drop caches:"
busybox sync
busybox sysctl -w vm.drop_caches=3
exit 0
EOF
}
both_funct(){
cat > /data/TrimDropOff/TrimDropOff_Cron << EOF
#!/system/bin/sh
# This script was authored by Defiant07 @ xda. Feel free to use it as you see fit, but please give proper credits.
# Read Karl Marx.
exec 1>/data/TrimDropOff/CronRan.log
echo "\$(date +"%r %Y.%m.%d"): Trimming, Dropping."
echo "/system:"
busybox sync
fstrim -v /system
echo "/data:"
busybox sync
fstrim -v /data
echo "/cache:"
busybox sync
fstrim -v /cache
echo "drop caches:"
busybox sync
busybox sysctl -w vm.drop_caches=3
exit 0
EOF
}
cron_starter(){
cat > /system/etc/init.d/07TrimDropOff_Cron << EOF
#!/system/bin/sh
# This script was authored by Defiant07 @ xda. Feel free to use it as you see fit, but please give proper credits.
# Read Karl Marx.
tdo_time(){
while [ ! "\`ps | grep -m 1 [a]ndroid\`" ]; do sleep 10; done
crond
exec 1>/data/TrimDropOff/CronBoot.log
echo "\$(date +"%r %Y.%m.%d"): cron.d service started."
echo "PIDs:"
pgrep crond
pidls=\`pgrep crond\`
echo "Verify Correct PIDs:"
for i in \$pidls; do
cat /proc/\$i/cmdline
done
echo ""
echo "RAM Usage:"
for i in \$pidls; do
dumpsys meminfo | grep \$i | grep -m 1 crond
done
}
if [ "\`ps | grep -m 1 [a]ndroid\`" ]; then tdo_time
else exec > /data/TrimDropOff/Cron_BootErrors.log 2>&1
tdo_time &
fi
exit 0
EOF
}
echo "Do you want to run fstrim and/or drop_caches"
echo "on a schedule?"
echo -n "Input es or o: "
read sched_opt
echo
case $sched_opt in
y|Y)echo "Which function do you want to schedule?"
echo "Input (f)strim only, (d)rop_caches only,"
echo -n "or (b)oth: "
read funct_opt
echo
case $funct_opt in
f|F)only_fstrim;;
d|D)only_drop;;
b|B)both_funct;;
*)input_error;;
esac
chmod 755 /data/TrimDropOff/TrimDropOff_Cron
echo "Do you want to schedule the function(s)"
echo "on an hourly or daily basis?"
echo -n "Input (h)ourly or (d)aily: "
read sched_opt
echo
if [ ! -d "/system/etc/cron.d" ]; then
mkdir /system/etc/cron.d
chmod 755 /system/etc/cron.d
fi
if [ ! -d "/system/etc/cron.d/crontabs" ]; then
mkdir /system/etc/cron.d/crontabs
chmod 755 /system/etc/cron.d/crontabs
fi
cron_starter
chmod 755 /system/etc/init.d/07TrimDropOff_Cron
case $sched_opt in
h|H)echo "Input 1 to run every hour, 2 to run every two hours,"
echo -n "3 to run every three hours...etc: "
read hour_opt
echo
if [ ! "`echo $hour_opt | awk '!/[^0-9]/'`" ]; then
input_error
fi
if [ -f "/system/etc/cron.d/crontabs/root" ]; then
echo "0 */$hour_opt * * * nohup /data/TrimDropOff/TrimDropOff_Cron" >> /system/etc/cron.d/crontabs/root
else
echo "0 */$hour_opt * * * nohup /data/TrimDropOff/TrimDropOff_Cron" > /system/etc/cron.d/crontabs/root
fi
chmod 755 /system/etc/cron.d/crontabs/root;;
d|D)echo "Input 0 to run at midnight every day,"
echo "1 to run at 1:00 am...13 to run at 1:00 pm"
echo -n "...etc...up to 23: "
read daily_opt
echo
if [ ! "`echo $daily_opt | awk '!/[^0-9]/ && $1<=23'`" ]; then
input_error
fi
if [ -f "/system/etc/cron.d/crontabs/root" ]; then
echo "0 $daily_opt * * * nohup /data/TrimDropOff/TrimDropOff_Cron" >> /system/etc/cron.d/crontabs/root
else
echo "0 $daily_opt * * * nohup /data/TrimDropOff/TrimDropOff_Cron" > /system/etc/cron.d/crontabs/root
fi
chmod 755 /system/etc/cron.d/crontabs/root;;
*)input_error;;
esac;;
n|N);;
*)input_error;;
esac
cat > /system/xbin/trimdrop << EOF
#!/system/bin/sh
# This script was authored by Defiant07 @ xda. Feel free to use it as you see fit, but please give proper credits.
# Read Karl Marx.
clear
trimmer(){
echo "/system:"
busybox sync
fstrim -v /system
echo "/data:"
busybox sync
fstrim -v /data
echo "/cache:"
busybox sync
fstrim -v /cache
}
dropper(){
echo "drop caches:"
busybox sync
busybox sysctl -w vm.drop_caches=3
}
echo -n "Do you want to run (f)strim, (d)rop_caches=3, or (b)oth? "
read funct_opt
echo
case \$funct_opt in
f|F)trimmer;;
d|D)dropper;;
b|B)trimmer
dropper;;
*)echo "That is not a valid input...try again...bye ."
exit 69;;
esac
echo
echo "All done...enjoy! You can close your app now."
exit 0
EOF
chmod 755 /system/xbin/trimdrop
mount_ro
echo "In addition to making the files required by"
echo "your desired configuration, I have also made"
echo "an on-the-fly script to run fstrim and/or"
echo "drop_caches on-demand."
echo "To use it, in terminal do: su -c trimdrop"
echo
sleep 3
echo "Reboot your device to start your desired services."
echo
sleep 3
echo "If you want to know how to verify everything"
echo "is working, read the script's OP (FFS)!"
echo
sleep 5
echo "All done...enjoy! You can close your app now."
exit 0
Click to expand...
Click to collapse
Changelog:
v2.0
made in to installer script
added cron options
added bootloop precautions to the init.d scripts (should make it compatible with all devices that meet the requirments)
the on-the-fly script, trimdrop, now allows user to choose fstrim and/or drop_caches=3
added more syncs to further ensure no data is lost
a bunch of other stuff I probably forget
v2.1
bug fixes - fixed issue if using only sync option (missing directory); fixed display of irrelevant errors in uninstall routine
cleaned code a bit (reduced redundancy)
Click to expand...
Click to collapse
Download History:
Defiant07s_TrimDropOff.zip - [Click for QR Code] (1.6 KB, 162 views)
Defiant07s_TrimDropOff_v2.0_[NOT_FLASHABLE].zip - [Click for QR Code] (3.0 KB, 89 views)
Click to expand...
Click to collapse
Credits:
Big thanks to @zeppelinrox, @dk_zero-cool, & @gu5t3r for their contributions to portions of this script (see the code of my other script SwapItOn for detailed citations).
Much thanks to @mdamaged for spotting the issue with sync init.d script and his note regarding syncing data.
Click to expand...
Click to collapse
Don't forget to click THANKS and RATE 5 STARS if you found this useful :highfive:.
peep my other script SwapItOn
Update to v2.1 if you were only using the sync option.
If you were using both the sync and schedule options or only the schedule option there is no need to update; the bug I found would not effect you.​
reserved...on the off chance it will be needed
Thanks, sounds interesting. I'm assuming the zip can be flashed right after flashing a new rom?
MidnightDevil said:
Thanks, sounds interesting. I'm assuming the zip can be flashed right after flashing a new rom?
Click to expand...
Click to collapse
Not a flashable ZIP per line 2.
AnarchoXen said:
Not a flashable ZIP per line 2.
Click to expand...
Click to collapse
Oh, thanks
Is compatible with custom kernel? Franco in my case
vía n7II r-paco
Will performing trimming operations too frequently cause additional flash memory degradation?
MidnightDevil said:
Thanks, sounds interesting. I'm assuming the zip can be flashed right after flashing a new rom?
Click to expand...
Click to collapse
As you were informed the zip is NOT flashable. If there is sufficient interest (say a 100 downloads) I'll make it flashable/aroma.
jordirpz said:
Is compatible with custom kernel? Franco in my case
vía n7II r-paco
Click to expand...
Click to collapse
Yes, it should be compatible...the fstrim utility is part of the rom (it should be in all nexus 4.3+ roms).
creeve4 said:
Will performing trimming operations too frequently cause additional flash memory degradation?
Click to expand...
Click to collapse
No, to my limited knowledge it should not be harmful (in fact it should increase lifespan - google "fstrim lifespan"). Did a quick google search but could not find anything definitive/reliable regarding frequency...what I did see seemed to suggest 'no' though.
If you are concerned about the frequency, you could not install the init.d script and just use the on-the-fly script, trimdrop, to trim on-demand. Should there be interest and if I have the motivation and time, I have been thinking about making this in to an installer script and/or aroma zip with cron-based options so it could be scheduled hourly, daily, or weekly.
Scheduling options would be awesome!
creeve4 said:
Scheduling options would be awesome!
Click to expand...
Click to collapse
+1
creeve4 said:
Scheduling options would be awesome!
Click to expand...
Click to collapse
BUBA0071 said:
+1
Click to expand...
Click to collapse
Seems there is a decent amount of interest (almost 100 downloads already ...thanks peeps), as such I'll add options and make things more configurable.
Regarding scheduling, I was thinking of doing hourly, daily (with ability to choose time), and weekly (with ability to choose day and time) options. Would every other hour or some other setting be desirable?
Regarding installation, what would be the preferred method, an installer script (e.g. V6 SuperCharger) or AROMA? Flashable zips would be another option, but would have less options/be less configurable.
Gimme some feedback and I'll put something together in the next week or two depending on work and my motivation .
wasn't this a nexus 7 2012 issue and fixed in the new version 2013?
defiant07 said:
Seems there is a decent amount of interest (almost 100 downloads already ...thanks peeps), as such I'll add options and make things more configurable.
Regarding scheduling, I was thinking of doing hourly, daily (with ability to choose time), and weekly (with ability to choose day and time) options. Would every other hour or some other setting be desirable?
Regarding installation, what would be the preferred method, an installer script (e.g. V6 SuperCharger) or AROMA? Flashable zips would be another option, but would have less options/be less configurable.
Gimme some feedback and I'll put something together in the next week or two depending on work and my motivation .
Click to expand...
Click to collapse
My 2 cents:
I would choose a daily option for my device.
I prefer Aroma over a script, but if you cannot get the customization you want with Aroma, then by all means go with a script.
Thanks again for the script and willingness to make it even better!
Thanks for the scripts, I time my startup, and this improved startup time by about 3-4secs, among other noticible improvements, apparently the stock OS does not run fstrim enough, initial operations freed several gigs on the data partition, and hundreds of megs on the others...
creeve4 said:
My 2 cents:
I would choose a daily option for my device.
I prefer Aroma over a script, but if you cannot get the customization you want with Aroma, then by all means go with a script.
Thanks again for the script and willingness to make it even better!
Click to expand...
Click to collapse
+1
Im going to turn this into a cron job, that will take care of scheduling, unless anyone else gets there first ( please lol )
Will give it a go in its present form, whats its resource footprint just sitting there waiting for screen off ?
Can we trigger the action from the screen off event ? or some other interupt type way ?
Great script by the way, your bash is damn site better than mine, jealous lol
KiaraTheDragon said:
wasn't this a nexus 7 2012 issue and fixed in the new version 2013?
Click to expand...
Click to collapse
Yes, I think this is true to a degree...it was more of a problem on the 2012 and other nexus devices. See the links in the OP for the conditions that need to be met for fstrim to autorun...for some users (myself included) the conditions will seldom if ever be met. Also see @mdamaged post; I get similar results the first time fstrim is initiated by my script after each boot...subsequent runs normally only frees up memory on /data.
creeve4 said:
My 2 cents:
I would choose a daily option for my device.
I prefer Aroma over a script, but if you cannot get the customization you want with Aroma, then by all means go with a script.
Thanks again for the script and willingness to make it even better!
Click to expand...
Click to collapse
imfun said:
+1
Click to expand...
Click to collapse
Okay will get to making an AROMA package...it will be my first, but it looks easy enough :fingers-crossed:...gimme a week or two to put it together and fully test.
mdamaged said:
Thanks for the scripts, I time my startup, and this improved startup time by about 3-4secs, among other noticible improvements, apparently the stock OS does not run fstrim enough, initial operations freed several gigs on the data partition, and hundreds of megs on the others...
Click to expand...
Click to collapse
Thanks for the feedback. I get similar results.
jubei_mitsuyoshi said:
Im going to turn this into a cron job, that will take care of scheduling, unless anyone else gets there first ( please lol )
Will give it a go in its present form, whats its resource footprint just sitting there waiting for screen off ?
Can we trigger the action from the screen off event ? or some other interupt type way ?
Great script by the way, your bash is damn site better than mine, jealous lol
Click to expand...
Click to collapse
See the first post on this page and my response to @creeve4 and @imfun in this post. I will make an AROMA package with cron options for fstrim and drop_caches=3.
However, should you feel ambitious and beat me to it, props to you...I will give you full credit in the OP and link your post as the d/l source so you should get the 'thanks' too.
Regarding triggering with screen on/off or some other event: It can probably be done, but I it's beyond my knowledge (screen on/off was actually the first trigger event I looked in to using, but despite fairly extensive searching I could not find how to detect it).
Regarding resource footprint: Read the OP (usage section) it explains where to find the log which contains this info and how to do it via terminal (should you not trust me )...also see OP (benefits section): in all my testing I have never seen it use more that .8 mb, but most of the time it is less than .2 mb.
Okay will get to making an AROMA package...it will be my first, but it looks easy enough :fingers-crossed:...gimme a week or two to put it together and fully test.
Click to expand...
Click to collapse
Can't wait already, because after whole day or two, hard usage of my nexus 7 tablet, the tablet starts to get laggy. I can see this on web browsing, touch press delay time, and onyl rebooting seems to help... Hope after istaling this will solve the problems
ohhh no dont want any credit lol lol, i have turned it into a cron job quite simply by adding it to the cron initilising script
Code:
###########
# IMPORTS #
###########
. /system/etc/init.d.cfg
#############
# FUNCTIONS #
#############
symlink_system_bin() {
# crond has "/bin/sh" hardcoded
if busybox [ ! -h /bin ]
then
mount -o remount,rw rootfs /
busybox ln -s /system/bin /bin
mount -o remount,ro rootfs /
fi
}
export_timezone() {
# set timezone (if you're not between -0500 and -0800 you get PST)
# todo - support other timezones
timezone=`date +%z`
if busybox [ $timezone = "-0800" ]; then
TZ=PST8PDT
elif busybox [ $timezone = "-0700" ]; then
TZ=MST7MDT
elif busybox [ $timezone = "-0600" ]; then
TZ=CST6CDT
elif busybox [ $timezone = "-0500" ]; then
TZ=EST5EDT
else
TZ=PST8PDT
fi
export TZ
}
set_crontab() {
# use /data/cron, call the crontab file "root"
if busybox [ -e /data/cron/root ]
then
mkdir -p /data/cron
cat > /data/cron/root << EOF
0 20 * * * sync; echo 3 > /proc/sys/vm/drop_caches
0 20 * * * sync; fstrim -v /system
0 20 * * * sync; fstrim -v /data
0 20 * * * sync; fstrim -v /cache
01 * * * * busybox run-parts /system/etc/cron/cron.hourly
02 4 * * * busybox run-parts /system/etc/cron/cron.daily
22 4 * * 0 busybox run-parts /system/etc/cron/cron.weekly
EOF
fi
busybox crond -c /data/cron
}
########
# MAIN #
########
if $enable_cron -a is_busybox_applet_available crond
then
symlink_system_bin
export_timezone
set_crontab
fi
adding the lines
Code:
0 20 * * * sync; echo 3 > /proc/sys/vm/drop_caches
0 20 * * * sync; fstrim -v /system
0 20 * * * sync; fstrim -v /data
0 20 * * * sync; fstrim -v /cache
should drop the caches and fstrim every 8 hours, oviously set to anything you want.
i also stuck it in boot at the end
/system/etc/init.d/92jubei
Code:
#!/system/bin/sh
if $file_system_speedups
then
busybox mount -o remount,noatime,barrier=0,nobh /system
busybox mount -o remount,noatime /data
busybox mount -o remount,noatime,barrier=0,nobh /cache
else
busybox mount -o remount,noatime,nobh /system
busybox mount -o remount,noatime /data
busybox mount -o remount,noatime,nobh /cache
fi
echo "$(date +"%r %Y.%m.%d"): Trimming, Dropping."
busybox sync
echo "/system:"
fstrim -v /system
echo "/data:"
fstrim -v /data
echo "/cache:"
fstrim -v /cache
echo "drop caches:"
busybox sysctl -w vm.drop_caches=3
exit 0
For an aroma script you will prob have to stick the file in /system/etc/cron/cron.hourly, daily, weekly and just give peeps that choice, will be most simple way. Ps not a fan of aroma lol
Ok, I should have spotted this issue right away, but did not, so here goes. It seems the use of while loop in the script in the OP causes any scripts with a lower priority in init.d to never get ran, if the script in the OP is the only one in your init.d this does not matter, nor should it matter if you have at boot script with a higher priority (they get ran before the OPs script).
I run the ElementalX kernel which depends on a init.d to initialize some parameters for the kernel, with this script in init.d they never get initialized, in my case this resulted in some things not 'taking' such as the battery life extender, which on my device, is set to stop charging at 4100mv, however, since the while loop kept the ElementalX init.d from running, it kept charging to ~4300mv, this is how I noticed (actually none of my settings wrt ElementalX were being initialized, but this symptom was most pronounced).
A simple fix would be to move up the priority of the ElementalX init.d script, but this would have to be done after each flash, and frankly since I run Tasker anyway, I saw no need for this, what I did was remove the OPs script from init.d and simply made a very simple task in Tasker to run /system/xbin/trimdrop when display goes off, it could just as easily be a time event.
Anyways, hope that helps someone who may come across this with other kernels, or other at-boot scripts which depend on being ran before the OPs script.
Again, thanks to the OP for his work. Also, I added another sync just before the drop caches, since the state of dirtyness could change after the fstrims.

[SCRIPT] Helium server PC download - separation

This is simple linux script I've made to separate all apps from one big zip file made by Helium sever -> PC download. Helium wiki says to don't try to do anything with this file, but I didn't want to restore all that stuff that I've backuped before bootloader unlock on my nexus 4. I'm sure it can be writed better, but it's working
Just place script file and unziped backup folder (must be named "backup") in one directory. After execution of the script everything should be ready to copying to carbon folder on your sd card/internal memory and restoring like after normal backup.
Tested on Ubuntu 14.04.
I'm not responsible for data loss or any other problem. Use at your own risk.
Constructive criticism welcome.
Code:
#!/bin/bash
DIRECTORY='./backup'
if [ -f $DIRECTORY/backup.json ]; then
cp $DIRECTORY/backup.json $DIRECTORY/temp.json
sed -e "s/{\"packages\"://g" $DIRECTORY/temp.json > $DIRECTORY/temp2.json
tr '[]' ' ' < $DIRECTORY/temp2.json | tee $DIRECTORY/temp.json
tr '}' '\n' < $DIRECTORY/temp.json | tee $DIRECTORY/temp2.json
sed -e "s/,{/{/g" $DIRECTORY/temp2.json > $DIRECTORY/temp.json
sed -e 's/^[ \t]*//' $DIRECTORY/temp.json > $DIRECTORY/temp2.json
sed '/^$/d' $DIRECTORY/temp2.json > $DIRECTORY/temp.json
sed 's/\([^|]\)$/\1}/' $DIRECTORY/temp.json > $DIRECTORY/temp_last.json
fi;
count=`ls -1 $DIRECTORY/*.ab 2>/dev/null | wc -l`
if [ $count != 0 ]; then
for i in $DIRECTORY/*.ab ; do
AB=$(basename $i)
mkdir -p $DIRECTORY/${AB%.*}
mv -i $DIRECTORY/$AB $DIRECTORY/${AB%.*}/
if [ -f $DIRECTORY/${AB%.*}.png ]; then
mv -i $DIRECTORY/${AB%.*}.png $DIRECTORY/${AB%.*}/._${AB%.*}.png
fi;
if [ ! -f $DIRECTORY/${AB%.*}/${AB%.*}.json ];then
touch $DIRECTORY/${AB%.*}/${AB%.*}.json
fi;
while read p; do
if [[ "$p" =~ "${AB%.*}" ]]; then
echo "$p" > $DIRECTORY/${AB%.*}/${AB%.*}.json
fi;
done <$DIRECTORY/temp_last.json
done;
fi;
rm $DIRECTORY/temp.json
rm $DIRECTORY/temp2.json
rm $DIRECTORY/temp_last.json
exit;

Categories

Resources