• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help Terminal Emulator - calling a script

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
 
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!
 
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!

Thanks i almost tied to answer this. Mine would have sucked next to yours. Ha good thing i waited.
 
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!

Thank you,
Updated video showing me running a script named "ll" (list logs) using your instructions:
http://youtu.be/s_vSwcW90oU
 
sorry for bumping an old topic, following b_randon14's suggestion, i created adbwifi.sh and content
#!/system/bin/sh
setprop service.adb.tcp.port 5555
stop adbd
start adbd

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?
 
Back
Top Bottom