Terminal Emulator - calling a scriptSupport


  1. mhlsilverdale

    mhlsilverdale Well-Known Member

    I'm trying to keep my log file growth in check on my triumph.
    I have a text file I can paste into Terminal Emulator that will delete log files in /data; I want to be able to load this file from terminal emulator. I can get it to load, but it seems lost; (e.g., can't mount, can't change directories...) Can some one tell me how to load a file into terminal emulator that will run like when I paste the same commands into it? Basically, I'm trying to load a text file with these commands;

    su
    mount -o remount,rw -t yaffs2 /dev/block/mtdblk8 /data
    cd /data
    rm alog_events
    rm alog.?
    rm plog.log.?
    rm pmlog.log.?
    rm alog_radio.?
    rm alog_system.?
    exit

    .......
    Note:
    I was able to run the a script with SManager and it worked (I'd still like to know how to do it from the terminal).

    This is a YouTube link to the video; http://youtu.be/jmAGTiRdYl8
    1) Open Script Manager
    2) List Script
    3) Edit Mode (so you can see the commands)
    4) Execute (Run) the file
    The 'ls' at the end of the script shows a directory listing with only the base log file names left and of course 'event_logs' is gone.

    #!/system/bin/sh
    cd /data
    ls -l alog*
    ls -l p*.log
    rm alog_events
    rm alog.?
    rm plog.log.?
    rm pmlog.log.?
    rm alog_radio.?
    rm alog_system.?
    ls alog*
    ls p*.log
    exit

    Advertisement
    :
  2. mhlsilverdale

    mhlsilverdale Well-Known Member

    Figured it out...

    1) open terminal emulator
    2) SU <enter>
    3) exec sh /mtn/sdcard/scripts/test.sh <enter>

    Trick was to execute a shell in front of the path as seen in (3).

    Video: http://youtu.be/nYAjwpb9B1Q

    >Mark
  3. b_randon14

    b_randon14 Well-Known Member Developer

    the best way I have found and it makes it the easiest is to make you a shell script with #!/system/bin/sh at the top line, and then your script after that. Then name the script something easy to remember like rmlogs or something(don't have to put .sh or . anything after it). Then copy that script into /system/bin and give it read write and execute permissions (chmod /system/bin/<name of script> 0755) and now where it is in system/bin, that directory is added to the path of the terminal emulator, so you can simply type in rmlogs on the terminal emulator, and it will execute the script, after calling su of course.

    I make scripts all the time and place them in /system/bin for ease of executing!
  4. markzombie82

    markzombie82 Well-Known Member

    Thanks i almost tied to answer this. Mine would have sucked next to yours. Ha good thing i waited.
  5. mhlsilverdale

    mhlsilverdale Well-Known Member

    Thank you,
    Updated video showing me running a script named "ll" (list logs) using your instructions:
    http://youtu.be/s_vSwcW90oU
  6. toink

    toink Member

    sorry for bumping an old topic, following b_randon14's suggestion, i created adbwifi.sh and content
    it doesn't get executed when typing adbwifi in terminal, and also manually executing it using sh command executes the script, but using getprop service.adb.tcp.port value is not 5555.. any suggestions?
Loading...

Share This Page