Permalink
Browse files

RESTORED drop RAM cache Cron job. requested by users, set as OFF.

  • Loading branch information...
1 parent 85cf74a commit 8a2ff436135a13f1dda8ab4a5aa95e1718231ca8 @dorimanx committed Nov 19, 2012
@@ -0,0 +1,29 @@
+#!/sbin/busybox sh
+
+PROFILE=`cat /data/.siyah/.active.profile`;
+. /data/.siyah/$PROFILE.profile;
+
+if [ "$cron_drop_cache" == "on" ]; then
+
+ MEM_ALL=`free | grep Mem | awk '{ print $2 }'`;
+ MEM_USED=`free | grep Mem | awk '{ print $3 }'`;
+ MEM_USED_CALC=$(($MEM_USED*100/$MEM_ALL));
+
+ # do clean cache only if cache uses 50% of free memory.
+ if [ "$MEM_USED_CALC" \> 50 ]; then
+
+ # wait till CPU is idle.
+ while [ ! `cat /proc/loadavg | cut -c1-4` \< "3.50" ]; do
+ echo "Waiting For CPU to cool down";
+ sleep 30;
+ done;
+
+ sync;
+ sysctl -w vm.drop_caches=3
+ sync;
+ sysctl -w vm.drop_caches=1
+ sync;
+ date +%H:%M-%D-%Z > /data/crontab/cron-clear-ram-cache;
+ echo "Cache above 50%! Cleaned RAM Cache" >> /data/crontab/cron-clear-ram-cache;
+ fi;
+fi;
View
@@ -1 +1,2 @@
# This file is at /system/etc/cron.d/crontabs/root
+0 0-23/1 * * * /sbin/busybox sh /data/crontab/cron-scripts/drop-cache-only.sh
@@ -88,6 +88,7 @@ led_on_touch=off
touchkey_brightness=2700
dyn_brightness=on
crontab=off
+cron_drop_cache=off
cron_clear_app_cache=off
cron_fix_permissions=off
cron_zipaling=off
@@ -481,6 +481,9 @@
<button description="Use this button to RESET Cron scripts and jobs from kernel to refresh the configuration, This will clear all custom changes!" name="CRON Function Reset" action="push-actions/crontab_reset" label="Reset Cron Files"/>
+ <checkbox description="Cron Task to clear RAM Cache/Buffers every HOUR only if CPU is resting(IDLE)! this will free RAM from buffers and not used cache"
+ name="RAM Cache Clean Task" action="generic_cortex /tmp/cron_drop_cache" label="RAM Cache Clean Every Hour"/>
+
<checkbox description="Cron Task to clear APP cache every 4:00AM only if CPU is resting(IDLE)! this can maintain free space on data partition, and clean all old junk."
name="DISK Clean Task" action="generic_cortex /tmp/cron_clear_app_cache" label="DISK Clean Task Every 4:00AM"/>
@@ -88,6 +88,7 @@ led_on_touch=off
touchkey_brightness=3000
dyn_brightness=off
crontab=off
+cron_drop_cache=off
cron_clear_app_cache=off
cron_fix_permissions=off
cron_zipaling=off
@@ -88,6 +88,7 @@ led_on_touch=off
touchkey_brightness=2700
dyn_brightness=on
crontab=off
+cron_drop_cache=off
cron_clear_app_cache=off
cron_fix_permissions=off
cron_zipaling=off
@@ -88,6 +88,7 @@ led_on_touch=off
touchkey_brightness=3000
dyn_brightness=off
crontab=on
+cron_drop_cache=off
cron_clear_app_cache=on
cron_fix_permissions=off
cron_zipaling=on
@@ -88,6 +88,7 @@ led_on_touch=off
touchkey_brightness=3000
dyn_brightness=on
crontab=on
+cron_drop_cache=off
cron_clear_app_cache=on
cron_fix_permissions=off
cron_zipaling=on

0 comments on commit 8a2ff43

Please sign in to comment.