Register Hello & Welcome to Andriodtablets.net, is this your first visit?

Scripts for repetitive terminal commands like - reboot recovery

This is a discussion on Scripts for repetitive terminal commands like - reboot recovery within the Coby Generation 1 Technical forums, part of the Coby Generation 1 category; In Linux scripts are great for automating a series of terminal commands. Back in MS-DOS days I used batch files to automate a series of ...


Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 23
Thanks Tree1Thanks

Thread: Scripts for repetitive terminal commands like - reboot recovery

  1. #1
    Senior Member
    Points: 3,586, Level: 37
    Level completed: 58%, Points required for next Level: 64
    Overall activity: 4.0%
    Achievements:
    1 year registered 500 Experience Points 1000 Experience Points 250 Experience Points 100 Experience Points

    Member #
    9253
    Join Date
    Dec 2010
    Location
    Ridgeland, WI, USA
    Posts
    284
    Thanked
    9 times
    Points
    3,586
    Level
    37
    Device
    Coby MID7015-4G

    Scripts for repetitive terminal commands like - reboot recovery

    In Linux scripts are great for automating a series of terminal commands. Back in MS-DOS days I used batch files to automate a series of commands.
    In Android you can also create scripts to automate a series of task - no typing just click to select - and it runs.
    My MID7015 is rooted with a Superuser.apk. I'm using gscript app to run the script.
    Here are the three steps I want to automate:
    cp /sdcard/clockworkmod/recovery.img /sdcard/recovery.img
    flash_image recovery /sdcard/recovery.img
    reboot recovery
    This simple script reboots my Coby to the Clockworkmod menu. No holding buttons required.

    I try to keep root of /sdcard/ nearly empty and store files safely in subdirectories like /sdcard/clockworkmod (which is where the backups will be stored too.) So the first command is just to copy my Clockworkmod recovery.img file to the root of /sdcard/.
    The second command flashes the image, the third command reboots the system.

    So more of the nitty gritty. gscript has a text editor which I didn't like at all so I edited using TextEdit.
    Install the app gscript
    Launch TextEdit and type in the three commands above.
    Save the file as /sdcard/gscript/Boot_Recovery.sh
    (has to end with .sh or it will not run)
    Launch gscript
    Click on the menu button, select "Add Script"
    click on [Load file]
    Select the Boot_Recovery.sh file
    Leave [x] Needs SU? turned on
    click on [Save]

    Now see how easy it is to boot to recovery.img
    Just click on the script.
    On my tablet a SuperUser screen pops up requiring my permission to run the script as superuser.
    I click OK - you can set it to remember so this does not pop up again.
    In seconds my tablet is booting the recovery image and I can select "backup" "restore" etc.

    Sorry to be long winded but new bees need detail. It seems hard the first time but you'll appreciate it the second time you just click and reboot.

    What other scripts have you created? Need to see?
    Last edited by Ridgeland; 05-08-2011 at 05:40 AM. Reason: Simpler version
    popeye1128 thanked this.

  2. # ADS
    Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

  3. #2
    Member
    Points: 959, Level: 16
    Level completed: 59%, Points required for next Level: 41
    Overall activity: 0%
    Achievements:
    1 year registered 500 Experience Points 250 Experience Points 100 Experience Points 3 months registered

    Member #
    9247
    Join Date
    Dec 2010
    Posts
    49
    Thanked
    1 times
    Points
    959
    Level
    16
    If clockwork recovery is flashed correctly you would not need a script to flash it every time you want to boot into recovery. There are several reboot apps on the market that allow 2 click reboots, either into recovery or normal.

    Sent from my SPH-M900

  4. #3
    Senior Member
    Points: 3,586, Level: 37
    Level completed: 58%, Points required for next Level: 64
    Overall activity: 4.0%
    Achievements:
    1 year registered 500 Experience Points 1000 Experience Points 250 Experience Points 100 Experience Points

    Member #
    9253
    Join Date
    Dec 2010
    Location
    Ridgeland, WI, USA
    Posts
    284
    Thanked
    9 times
    Points
    3,586
    Level
    37
    Device
    Coby MID7015-4G
    This thread was meant to help others see how to write and use scripts.
    The example of recovery.img was meant only as an example.
    If I had used an example with just "ls" that might have been too simple but would have still presented the concept.
    Next I'll toy with scripts that install a list of apps (to use after a factory reset).

  5. #4
    Member
    Points: 959, Level: 16
    Level completed: 59%, Points required for next Level: 41
    Overall activity: 0%
    Achievements:
    1 year registered 500 Experience Points 250 Experience Points 100 Experience Points 3 months registered

    Member #
    9247
    Join Date
    Dec 2010
    Posts
    49
    Thanked
    1 times
    Points
    959
    Level
    16
    Ok. I got ya. I had a hard time getting clockwork to stick until I found the "mv" command. When I saw this I was thinking that some people may think this is a workaround for getting clockwork to stick, which would be a bad idea since you would not be able to access recovery if you were to get stuck in a boot loop or otherwise brick your tablet...

  6. #5
    Senior Member
    Points: 1,458, Level: 21
    Level completed: 58%, Points required for next Level: 42
    Overall activity: 2.9%
    Achievements:
    1000 Experience Points

    Member #
    12776
    Join Date
    Jan 2011
    Location
    Mississauga Canada
    Posts
    147
    Points
    1,458
    Level
    21
    Funny... I was just thinking about batch files for Linux today...
    Thanks for the tutorial, keep it coming.
    What app are developers using to create Apps?

  7. #6
    Senior Member
    Points: 3,586, Level: 37
    Level completed: 58%, Points required for next Level: 64
    Overall activity: 4.0%
    Achievements:
    1 year registered 500 Experience Points 1000 Experience Points 250 Experience Points 100 Experience Points

    Member #
    9253
    Join Date
    Dec 2010
    Location
    Ridgeland, WI, USA
    Posts
    284
    Thanked
    9 times
    Points
    3,586
    Level
    37
    Device
    Coby MID7015-4G
    willber,
    I had you in mind when I wrote this because you said you were using multiple backups and installs to test with and without Market.
    Rebooting Recovery.img will be easy this way.
    Don't you have Android Developers SDK?
    What is Android? | Android Developers
    Haven't you written your first helloworld.apk yet?
    Are you a Linux user?

  8. #7
    Senior Member
    Points: 1,458, Level: 21
    Level completed: 58%, Points required for next Level: 42
    Overall activity: 2.9%
    Achievements:
    1000 Experience Points

    Member #
    12776
    Join Date
    Jan 2011
    Location
    Mississauga Canada
    Posts
    147
    Points
    1,458
    Level
    21
    Yes the multiple rebootings and the old DOS days started me thinking about the batch ways of yesteryear. The need to reboot regarding the Market and the sleep issue is mute now. SoftLocker has resolved that issue.
    I tried loading up SDK and did get past the path issue when using Win7 64 bit but the issued showed up again because my Packages To Install was empty...! So I put it aside.
    Well I just fired up SDK again and low and behold, the Package list is now there. I guess Windoz just needed a cold boot...!
    I'm new to Linux but have experience using low level and higher level programming languages so this is intriguing to me.
    I'll investigate the SDK as I assume it is what's being used for writing apps.
    I don't want to high jack your thread... maybe another thread could be started on the beginnings of app development. There might be enough people interested on this subject. Maybe move it out of this forum.

  9. #8
    l_n
    l_n is offline
    Senior Member
    Points: 13,452, Level: 75
    Level completed: 51%, Points required for next Level: 198
    Overall activity: 2.2%
    Achievements:
    1000 Experience Points Recommendation Second Class Tagger Second Class 5000 Experience Points 10000 Experience Points

    Member #
    10861
    Join Date
    Dec 2010
    Location
    TN, USA
    Posts
    790
    Thanked
    89 times
    Points
    13,452
    Level
    75
    Device
    Mid7015
    There's a development subforum over in the tcc8902 section.

    Sent from my MID7015 using Tapatalk

  10. #9
    Senior Member Achievements:
    7 days registered 31 days registered 3 months registered Tagger Second Class 100 Experience Points

    Member #
    8681
    Join Date
    Dec 2010
    Location
    Florida
    Posts
    138
    Thanked
    5 times
    Device
    Coby Kyros MID7015
    Quote Originally Posted by willber View Post
    There might be enough people interested on this subject. Maybe move it out of this forum.
    App development sounds fantastic. I'm game.



    Sent from my MID7015

  11. #10
    Senior Member
    Points: 3,586, Level: 37
    Level completed: 58%, Points required for next Level: 64
    Overall activity: 4.0%
    Achievements:
    1 year registered 500 Experience Points 1000 Experience Points 250 Experience Points 100 Experience Points

    Member #
    9253
    Join Date
    Dec 2010
    Location
    Ridgeland, WI, USA
    Posts
    284
    Thanked
    9 times
    Points
    3,586
    Level
    37
    Device
    Coby MID7015-4G
    So a script to load an app looks easy but is not.
    From adb just run:
    adb install /path/my.app.apk
    Looks easy. Try that in the terminal
    install /path/my.app.apk
    and you get file not found, not the apk but the "install"
    From xda-developers (I end up there a lot)
    adb install in terminal emulator? - Page 2 - xda-developers
    post #13 has a good script that works in this case.
    The script though launches the installer which runs through the display of permissions and clicks required etc. Not good for a long list of apps.
    So using a script for this doesn't look promising.

    Another note is that I see a sh script is nothing more than a text file. I'm used to bash scripts (Bourne again Shell) which begin with #!/bin/bash. The sh scripts do not need a header line, just a simple text file like the old batch files in MS-DOS 3. I didn't test to see if the .sh is critical like the .bat was.


 
Page 1 of 3 1 2 3 LastLast

Sponsors:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. Cruz Tablet ADB mount commands?
    By kxs783kms in forum Velocity Micro Tablets
    Replies: 4
    Last Post: 01-02-2012, 08:49 PM
  2. [RECOVERY] Clockwork Recovery for Coby Kyros MID-7015
    By razor950 in forum Telechips TCC8902 Development
    Replies: 18
    Last Post: 04-18-2011, 02:24 PM
  3. [RECOVERY] Clockwork Recovery Test Image for Haipad M701 4GB (HY)
    By fun in forum Telechips TCC8902 Development
    Replies: 15
    Last Post: 03-24-2011, 07:40 PM
  4. Rooted but cant flash recovery in terminal?
    By bL33d in forum Augen Gentouch
    Replies: 1
    Last Post: 12-05-2010, 12:24 AM
  5. Useful Terminal Commands
    By OffWorld in forum Android Tablet Hacking
    Replies: 0
    Last Post: 11-06-2010, 03:51 PM

Search tags for this page

android reboot script

,
android shell array
,

android terminal commands

,

android terminal emulator reboot command

,
android terminal reboot command
,

android terminal reboot recovery

,
android terminal script
,

android terminal scripts

,
reboot android from terminal emulator
,

rebooting to recovery form terminal

,
terminal emulator android commands list
,

terminal emulator reboot recovery

Click on a term to search our sites for related topics.

Tags for this Thread

Powered by vBulletin® Version 4.1.11
Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.
Android Tablets.net is not affiliated or associated with Google, Android Project or any of the device manufacturers listed on this site.
We are simply an enthusiast site.
All times are GMT -5. The time now is 05:00 AM.