Go Back   Android Forums > Android Phones > Motorola Triumph

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old May 31st, 2012, 10:24 AM   #1 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: May 2012
Location: Pacific Northwest
Posts: 96
 
Device(s):
Carrier: Virgin Mobile

Thanks: 11
Thanked 25 Times in 16 Posts
Default 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

mhlsilverdale is offline  
Last edited by mhlsilverdale; June 1st, 2012 at 10:56 AM.
Reply With Quote
sponsored links
Old June 1st, 2012, 10:26 AM   #2 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: May 2012
Location: Pacific Northwest
Posts: 96
 
Device(s):
Carrier: Virgin Mobile

Thanks: 11
Thanked 25 Times in 16 Posts
Default I'll answer my own question

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
mhlsilverdale is offline  
Last edited by mhlsilverdale; June 1st, 2012 at 10:42 AM.
Reply With Quote
Old June 1st, 2012, 11:52 AM   #3 (permalink)
ROM Developer
 
b_randon14's Avatar
 
Join Date: Aug 2011
Location: Somerset, KY
Posts: 910
 
Device(s): Galaxy Note II N7100 Samsung Galaxy SII (VM) Motorola Triumph (VM) Samsung Intercept (VM)
Carrier: Virgin Mobile

Thanks: 165
Thanked 626 Times in 263 Posts
Default

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!
__________________
Donate if you like my work!

Gain 250mb and help me out, sign up for Dropbox here: 250mb Extra Space on Dropbox

find / -user your -name base -exec chown us:us '{}' ';'
b_randon14 is offline  
Reply With Quote
Old June 1st, 2012, 07:55 PM   #4 (permalink)
Member
 
markzombie82's Avatar
 
Join Date: Feb 2012
Posts: 350
 
Device(s):
Carrier: Not Provided

Thanks: 106
Thanked 28 Times in 25 Posts
Default

Quote:
Originally Posted by b_randon14 View Post
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.
markzombie82 is offline  
Reply With Quote
Old June 1st, 2012, 09:06 PM   #5 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: May 2012
Location: Pacific Northwest
Posts: 96
 
Device(s):
Carrier: Virgin Mobile

Thanks: 11
Thanked 25 Times in 16 Posts
Default

Quote:
Originally Posted by b_randon14 View Post
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
mhlsilverdale is offline  
Last edited by mhlsilverdale; June 2nd, 2012 at 12:26 PM.
Reply With Quote
Old November 12th, 2012, 11:57 PM   #6 (permalink)
New Member
 
Join Date: Feb 2011
Posts: 9
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry for bumping an old topic, following b_randon14's suggestion, i created adbwifi.sh and content
Quote:
#!/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?
toink is offline  
Reply With Quote
Reply

Motorola Triumph
Current Rating:
Rate this Phone:

The Motorola Triumph for Virgin Mobile sports a 4.1-inch screen on a super thin .4-inch body. With a 5MP camera that shoots HD video, a VGA front-facing camera, and HDMI-out, the Triumph offers a great set of features for Virgin Mobile customers ea... Read More



Go Back   Android Forums > Android Phones > Motorola Triumph
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:42 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.