User Tag List

  1. saltinbas's Avatar
    NEW VERSION!!!! NEW VERSION!!!!!!!!!

    DO NOT FORGET TO REBOOT AFTER INSTALL

    ( Not is Xsellize Repo )

    --------------------------------------------------------------------

    Download DEB version (1.1 Beta) file and reboot your iphone or ipod touch:

    http://www.multiupload.com/KM9QLICVLN

    --------------------------------------------------------------
    CHANGES:
    1.1 Beta :
    - Interval is defined in plist file under "StartInterval" key as 20 seconds
    - The script do not run when ipod or iphone is in sleep
    - While..do loop deleted from script.
    - A file called "degisken" under /usr/bin/ added to keep "old_memory" and "trigger" variables since script do not run in infinite loop.

    1.0 Beta :
    - Initial release


    --------------------------------------------------------------
    PURPOSE: The script checks if the free plus inactive memory, determined by vm_stat command, drops more than 2 MB and executes the sbsettings "com.sbsettings.freemem" app under /var/mobile/Library/SBSettings/Commands directory if the free memory is below 20 MB for 3G, 40 MB for 3GS and 10 MB for 2G. The script do not run when the ipod or iphone is in sleep. This version should improve battery life.

    ---------------------------------------------------------------

    FILES :

    1- /usr/bin/repeat_free_mem.sh
    ---------------------------------------
    #!/bin/sh
    cmdline=/var/mobile/Library/SBSettings/Commands/com.sbsettings.freemem
    usermem="$(sysctl hw.usermem | cut -d" " -f2 | cut -d":" -f2)"
    let "trigerring_treshold_memory= ( $usermem / 4 )"
    memory_threshold_3GS=40960
    memory_threshold_3G=20480
    memory_threshold_1G=10240
    memory_threshold_ipod_1G=10240
    memory_threshold_ipod_2G=20480
    memory_threshold_ipod_3G=40960
    trigerring_treshold_memory=10240
    max_difference=2048
    old_memory="$(grep o</usr/bin/degisken | cut -d"-" -f1 | cut -d"o" -f2)"
    trigger="$(grep t</usr/bin/degisken | cut -d"-" -f2 | cut -d"t" -f2)"


    phone_type="$(sysctl hw.machine | cut -d" " -f2 | cut -d":" -f2)"

    if [ "$phone_type" = 'iPhone2,1' ];
    then
    trigerring_treshold_memory="$memory_threshold_3GS" ;
    fi

    if [ "$phone_type" = 'iPhone1,2' ];
    then
    trigerring_treshold_memory="$memory_threshold_3G";
    fi

    if [ "$phone_type" = 'iPhone1,1' ];
    then
    trigerring_treshold_memory="$memory_threshold_2G";
    fi

    if [ "$phone_type" = 'iPod1,1' ];
    then
    trigerring_treshold_memory="$memory_threshold_ipod _1G";
    fi

    if [ "$phone_type" = 'iPod2,1' ];
    then
    trigerring_treshold_memory="$memory_threshold_ipod _2G";
    fi

    if [ "$phone_type" = 'iPod3,1' ];
    then
    trigerring_treshold_memory="$memory_threshold_ipod _3G";
    fi

    free="$(vm_stat | grep free | cut -d"." -f1 | cut -d":" -f2)"
    inactive="$(vm_stat | grep inactive | cut -d"." -f1 | cut -d":" -f2)"
    total=`expr $free + $inactive`
    memory=`expr $total + $total + $total + $total`
    change=`expr $old_memory - $memory`

    if test $change -gt $max_difference;
    then
    if test $trigger -eq 0;
    then
    trigger=1;
    fi
    fi

    if test $change -le $max_difference;
    then
    if test $trigger -eq 1;
    then
    if test $memory -lt $trigerring_treshold_memory;
    then
    $cmdline
    trigger=0;
    fi
    fi
    fi

    echo o"$memory"-t"$trigger">/usr/bin/degisken
    exit 0

    ---------------------------------------------------------


    2- /usr/bin/degisken :
    --------------------------------------------------
    o1-t0
    --------------------------------------------------

    3- /System/Library/LaunchDaemons/om.saltinbas.free.mem.plist
    --------------------------------------------------

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>com.saltinbas.free.mem</string>
    <key>Program</key>
    <string>/usr/bin/./repeat_free_mem.sh</string>
    <key>StartInterval</key>
    <integer>20</integer>
    <key>RunAtLoad</key>
    <true/>
    </dict>
    </plist>

    -----------------------------------------------------


    Please post your feedback so that we can improve the script .
    Last edited by saltinbas; 2009-12-25 at 08:09 AM. Reason: Update
    2009-12-08 01:48 PM
  2. stlcaddie's Avatar
    Awsome, I'll let you know later

    can u change it to activate earlier, like if i drop to just 70 or 80 mb?
    Last edited by stlcaddie; 2009-12-08 at 02:18 PM. Reason: Automerged Doublepost
    2009-12-08 02:18 PM
  3. joelchoy's Avatar
    i wanted to create a post regarding this but you've read my mind
    2009-12-08 04:00 PM
  4. virtru's Avatar
    Sorry, but I do not understand what he was doing
    2009-12-08 05:32 PM
  5. stlcaddie's Avatar
    So far so good, haven't needed to restore yet. And no crashes.
    2009-12-08 09:08 PM
  6. battlecrushr's Avatar
    Wait stlcaddie what did u do. I have a 3g and what is this
    2009-12-08 09:21 PM
  7. Bianca's Avatar
    So this script goes in the /var/mobile/ <<< is that right
    2009-12-08 11:49 PM
  8. stlcaddie's Avatar
    Yea, this dude hasn't responded so I would wait until somebody that knows script can make sure this isn't some setup. I've did it with nothing going wrong. But who knows what's going on in the background.

    Just my paranoid opinion.
    Last edited by stlcaddie; 2009-12-09 at 03:33 AM. Reason: Automerged Doublepost
    2009-12-09 03:33 AM
  9. saltinbas's Avatar
    Hi,

    You are correct. The script should be named "repeat_free_mem.sh" and put it under /var/mobile directory. Also please add "com.saltinbas.free.mem.plist" file into /System/Library/LaunchDaemons directory. The plist file will launch at the startup the "repeat_free_mem.sh" file.

    Yea, this dude hasn't responded so I would wait until somebody that knows script can make sure this isn't some setup. I've did it with nothing going wrong. But who knows what's going on in the background.

    Just my paranoid opinion.
    Hi,

    This is just a script executing the command listed below;

    vm_stat
    sleep
    cut
    grep
    "com.sbsettings.freemem" (this is the command sbsettings use to free memory)

    So there is nothing to be paranoid about.
    Last edited by saltinbas; 2009-12-09 at 06:23 AM. Reason: Automerged Doublepost
    2009-12-09 06:23 AM
  10. joelchoy's Avatar
    ^ can you make a simpler script that will auto free the memory once it's below 20mb?
    2009-12-09 02:45 PM
  11. purplefrozt's Avatar
    would it work on itouch 1gen?

    if not could i request for the script to auto free memory..

    thnx in advanced
    2009-12-17 03:36 AM
  12. saltinbas's Avatar
    would it work on itouch 1gen?

    if not could i request for the script to auto free memory..

    thnx in advanced
    Hi,

    I have just updated the script for the ipod touch.
    2009-12-17 06:10 AM
  13. joelchoy's Avatar
    i dont think there is a cut command in the ipod, iphones.
    2009-12-17 06:06 PM
  14. purplefrozt's Avatar
    thnx for the script hope it will improve my 1st gen. xD
    2010-02-05 12:26 PM
  15. iwannamod's Avatar
    hi, i recently updated the repeating memory thing and when it was finished i couldnt open up cydia. tried the ssh thing and deleted the files all except "partial". didnt work so i put them back. can anyone plz help? thx.
    2010-04-20 09:43 AM

Tags for this Thread

LINK TO POST COPIED TO CLIPBOARD