hi to all i want to make a script to reboot the phone via terminal but with a Confirmation ....
like
Reboot is required (y/n) :
if yes reboot
if no exit script
if other letter ask again
and i want to put it in the attached script... at the end of the script procedure..
plz help
Related
Hi guys, I was hoping someone could help me write a simple script that I can execute in terminal. What I would like the script to do is copy all the files from one directory to another directory on my sdcard (to cut down what i need to type in terminal each time).
For example
cp /sdcard/dir1/*.* /sdcard/dir2
I've tried to just put that command line in a unix txt file from Crimson Editor, saved it as copy.sh. I did
chmod +x copy.sh
Then tried to type in terminal
sh /sdcard/copy.sh
I didnt get any errors, but I don't think it worked. Any help or suggestions are appreciated.
My phone is a N1 with the latest Cyanogen build. Thanks in advance.
** EDIT **
I fixed the issue by using a program called GScript from the market... I made a new script in the GScript window and can now just open gscript and click the script to run it instead of typing the terminal commands. Don't know if this will help anybody else with similar newbie scripting issues, but it worked for what I wanted to get done. I'm editing post instead of deleting because I don't see the delete post button.
** EDIT **
AndroidManager v0.1
by ScumpinatoS
ScreenThere are no screen, the script operates on a command line
What is it?This script allows you to do anything on your android device even if you don't know anything about adb and/or about scripting
With this script you can:
1. Reboot
2. Go To Recovery Mode
3. Install an APP in /data/app
4. Install an APP in /system/app
5. Pull your framework folder
6. Stop your device (ROOT)
7. Start your device (ROOT)
8. Mount partitions Read-Write (ROOT)
9. Mount partitions Read-Only (ROOT)
10. Backup your /data/app folder (ROOT)
11. Restore your /data/app folder (ROOT and REBOOT)
12. Backup your SMS (ROOT)
13. Restore your SMS (ROOT and REBOOT)
14. Send a file to your SDCARD
15. Pull the build.prop
16. Push the build.prop
17. ADB Shell
18. Exit
Requirements
- Windows 98 or above
- An Android Device
- Admin rights (Vista/7)
- ROOT where needed
- USB DEBUG ON
How to use?
1. Download the Link at the end of the post
2. Double click on AndroidManager
3. Now the script is running
4. Choose the option that you want, then choose what do you want to do and the script will do everything
In the guided mode the script guides you trough the script telling you something about the command and how to use them It's good if you want to know how the script work or if you want to learn something about adb scripting
Now the download link:
AndroidManager v0.1
Changelog:
v0.1: Initial release
Enjoy and leave a feedback
Who wants the source code, ask to me in PM
IF YOU LIKE MY WORK, PLEASE THANK ME AND CONSIDER DONATE TO ME, EVEN 1$ IS GOOD, I'M JUST A STUDENT
Very usefull(you are a genius)
Thank you really much =)
I'm not a genius, I'm just a guy who loves making his life easier XD XD
I found a little bug (not very important to fix).
I have tried to shutdown(6) and works but 1 min ago when i tried it the screen just freeze, i have tried to shutdown again and nothing but when i tried poweron(7) the phone powered one whitout problem(theat freeze was funny whit the phone poweredoff but whit screen on ).
That isn't a bug. They are the adb shell stop and the adb shell start command. You need them when you want to modify the /system partition without having problems
Is this scrit useful to You?
What do you think of this script?
there're no option to install font?
Btw thank.
ScumpinatoS said:
Is this scrit useful to You?
What do you think of this script?
Click to expand...
Click to collapse
Very good for persones like me (i have a short cable and was hard to use the phone when was at pc) thease is what every android owner must have.
afifth said:
there're no option to install font?
Btw thank.
Click to expand...
Click to collapse
Based on the number of download and the number of donations [0 so far] I will decide if update this script or leave it as it is.
I have so more ideas in my mind, but I'm waiting to see the appeal of the script
IF there will be a 0.2 version, that option will be available
*bump*
Do you use/like this script? What do you think of it?
I started to use your script it's very usefull, thanks
You're welcome
If the script can reach 500 download by the end of the week will be upgraded to the v0.2
*up*
So? Any feedback?
I will stop developing this script because I found that http://forum.xda-developers.com/showthread.php?t=825934&highlight=androidmanager
I think that it isn't fair from me to steal the name, and btw that script is much much better than mine
Hi all.
Everyone here on our forum wants to help devs by testing different stuff but devs wants testers to send debug info to them so they can resolve bugs. Notifying bugs without logcats is useless and some users don't know how to collect these debug data.
To collect debug info there is a tool named ADB (Android Debugging Bridge). we r very small community and there are not plenty of sgr users around here so we have to worry about knowledgeable testers. so i m making this basic instructional guide to ADB. about how to set up ADB on windows and some basic usage.
Setting up ADB on windows.
Know this first.
> ADB requires usb drivers. So first of all install kies so that ur pc detects ur phone and ADB can recognise ur phone.
> Android is linux based and in linux commands are case sensitive so while typing these command use propare case otherwise commands won't execute.
> Windows uses back slash [\] and linux uses forward slash [/] so while typing file locations. For location of file in ur pc use back slash and for files in ur phone/sd card use forward slash.
there are two ways to setup adb on ur windows pc.
1 > download the android sdk, it includes the adb
u can download latest android sdk from HERE.
2 > only download adb package, no need of downloading the whole sdk.
look at the end of post to find the zip file of adb package.
now after downloading:
if u have downloaded sdk read this:
> after downloading sdk, extract it to ur desired location.
> after extracting, open that folder and goto "platform-tools" folder.
> now hold the shift key and hit right click in that directory
> click "open command window here"
> u will see command promp, type "adb" in command prompt. if adb executes means u have successfully setup adb on ur windows.
if u r using without sdk:
> just extract the package
> hold shift key, hit right click and choose "open command prompt here"
> type "abd" in command prompt and check if adb executes.
now as we have successfully setup adb lets begin to some basic commands.
first of all connect ur phone using usb cable. make sure u have checked usb debugging in settings>applications>development>check usb debugging.
now open adb as mentioned above and type
Code:
adb devices
u should see
Code:
list of attached devices
xyz device
xyz will be name of ur device, as default it will be some number.
Basic usefull ADB commands
1.
Code:
adb pull
this command can be used copy files from ur device to ur pc.
for eg.
Code:
adb pull /system/app/Camera.apk
this will copy the camera app to the directory where adb is extracted.
if u know the path u can copy anything using this command.
2.
Code:
adb push
this command can be used to push files to ur phone.
type the command, drag and drop the file in command prompt and than type location where u want to push that file and hit enter.
for eg, if i want to push image named android.jpg stored in my C drive.
Code:
adb push C:\android.jpg /sdcard/
this will push that image to sdcard.
sometimes we have to push some packages in specified folders. just type the location after file name.
for eg
Code:
abd push C:\sanim.zip /system/media
3.
Code:
adb install
with help of this command we can install apps to our phone dorectly from pc.
for eg. type "adb install" than leave one space with mouse choose apk file of app u want to install and drag and drop it in command prompt. path of that app will be displayed in command prompt. like this.
Code:
adb install C:\adb\Camera.apk
by executing this command u can install the app u have dragged and dropped in command prompt.
As i have written for windows but these commands can be used on ADB on linux/MacOS as well but i have only mentioned the set-up guide for windows only.
Credits/Source.
http://developer.android.com/tools/help/index.html
Getting Debug Infos (Logcats)
1. logcat
logcat is a report from android logging system which runs in background from the moment u boot ur phone. and it haves all the info what went wrong with system.
generally we can see logcat by typing
Code:
adb logcat
but that will show the constant data flow so better save it as file so can be sent to dev or u can study it later.
Code:
adb logcat > log.txt
this will store the logcat to directory of adb and collect log in text file.
2. bugreport
Code:
adb bugreport
bug report prints dumpsys, dumpstate, and logcat data to the screen. which can be used for bug reporting.
3. Java Debug Wire Protocol
Code:
adb jdwp
this command prints the list of available JDWP processes on connected device in command prompt.
Logcats On Mobileu can directly generate logcat on ur mobile using Terminal Emulator app, there are many terminal apps in market. CM comes with pre-loaded Terminal Emulator.
some terminal apps:
Android Terminal
Terminal Emulator
RomToolbox
u will need root access to generate logs
open terminal app, u will see following screen
Code:
$ export PATH=/data/local/bin:$PATH
$
now type su and hit enter.
allow super user permissions.
now to get a logcat type following command.
Code:
logcat > /mnt/sdcard/logcat.txt
this will generate text file named logcat.txt on root of ur sdcard which is containing logcat.
to get DMESG (Kernel Debug)
open terminal and type following command
Code:
su
dmesg > /mnt/sdcard/dmesg.txt
this will generate text file named dmesg.txt on root of ur sdcard which is containing kernel debug log.
Kernel Debugging.
we can use adb to debug kernel issues.
Code:
adb shell
dmesg
this will generate a log which is very helpful to resolve kernel issues, we just have to send this log to dev, he will look after it.
sometimes after flashing kernel we go into bootloop in that cases generate logcat using this commands and send to dev it will be very helpfull for dev to know and resolve reason causing bootloop.
Code:
adb shell
cat /proc/last_kmsg > /sdcard/last_kmsg
this command should be executed immediately on reboot otherwise it will be over written by new kernel message. the file will be stored on root of ur sdcard named last_kmsg. send this file to kernel dev it will help him great to resolve the problem.
Read this if u dont know how to get files from ur sdcard even if ur phone is not booting and stuck at bootloop.
u must have CWM to do this.
>boot ur phone in recovery mode (by holding VOL UP and HOME key together on boot)
>goto "Mounts and Storage"
>Select "Mount USB Storage" and plug in your data cable.
>Now u can access ur sdcard on ur pc, after ur work is done click "Unmount"
Hi,
Just a noob question... if my phone is stuck in a bootloop, is there anyway for me to get a logcat without flashing a new rom???
Sent from my GT-I9103 using xda app-developers app
JoJo2012 said:
Hi,
Just a noob question... if my phone is stuck in a bootloop, is there anyway for me to get a logcat without flashing a new rom???
Sent from my GT-I9103 using xda app-developers app
Click to expand...
Click to collapse
If you have enabled USB Debugging , yes
"I have to go. It's just....they really need me." - Sora
Re: Toggle mobile data on and off via adb
Does anybody know how to toggle mobile data on and off via ADB?? IM WILLING TO PAY FOR THIS INFO lol I NEED IT THAT BAD!! PM ME PLEEEASE!!!!!
12manytimes said:
Does anybody know how to toggle mobile data on and off via ADB?? IM WILLING TO PAY FOR THIS INFO lol I NEED IT THAT BAD!! PM ME PLEEEASE!!!!!
Click to expand...
Click to collapse
'adb shell su -c "svc data disable"' and 'adb shell su -c "svc data enable"'. You must be rooted.
Sent from my GT-I9103 with CM10
Adam77Root said:
'adb shell su -c "svc data disable"' and 'adb shell su -c "svc data enable"'. You must be rooted.
Sent from my GT-I9103 with CM10
Click to expand...
Click to collapse
Thanks alot, i just sent you a PM but it shows that i didn't send anything, so if you didn't get the message please send me one cuz id like to buy you a beer!
I wish i could hit your thanks button a million times right now lol
Hello I am trying to create a batch file that has an infinite loop and was wondering if there are any adb commands that can do this.
I am also looking for an adb command that waits x amount of seconds before performing the next command.?
Any help would be greatly appreciated
so before i start i apologize if im just being lazy but if i have posted this somehow "wrong" or whatever i probally messed up but hey!
ok. to whom it may have answers,
first of all. i realize what i am asking is a "easySBF" but i would like to learn and write my own shell script that will do these steps.
(since this is just for me, my "required files" will be located for sure. and some of the script i got, its just some i dont)
1) adb shell ln -s /data/local.prop /data/preinstall_md5/magic.md5
2) i suppose this would require a "pause?" or whatever until it was ready to throw the next command at it?
3) sbf a custom preinstall image (sbf -r --preinstall dx.img 621.sbf)
4) have it wait for the boot after the flash is done? then reboot the phone one more time?
5) then if possible i want it to "adb shell" and check for a root prompt (# not $) ?
6) if it returns "#" (root) it would then go onto installing superuser files? if its "$" (not root) have it (if possible a countdown timer of like 10 seconds?) ask if i want to try again with another reboot or something. the timer would automatically send it into a reboot | return to #5
7) from here i have to send 6 more adb shell/push commands (dont know if i need to allow a "pause" or something between the commands to insure a working command?"
then if all goes well it would say something lame of course but ya.
i hope i am asking this in a readable way, if ive confused you (probally) then blame my upbringing or lack of concern for the english language
but if you can help then uhm. good looking out and either post it or pm me (makes it easier actually for me but anything is better than nuttin)
thank you in advance
@deadseth
"i die alot"
Today most of us use one click softwares to work with our android phones or tablets.
Ever wondered how these work ??
If,yes today i will teach you how to make your own "one click custom recovery for your phone". :good:
Before we begin we need a few requirements. The basic things include
TWRP image for your phone
You can download the image for your phone by clicking here
Notepad or any other similar software installed on your pc
Some knowledge on creating a ".bat" file
and a device with unlocked bootloader
Once you have this lets get started.
First download and extract the "Recovery files.zip" from the attachments
How to make a one click recovery
After downloading copy the twrp image to this folder.
Now,Create a new text file and write the following commands.
Before that let us understand some basic bat file commands.
The word "echo" is used to add lines in bat file. If u want to add blank lines just type "echo." and to add text or any other symbols type "echo <your text> " Make sure you leave a space after echo and eliminate the"<>" symbols.
To change the default colour,type "color 0a". You can try changing "a" with "b","c" etc to see new colours.
The "pause" Command is used to view the message "Press any key to continue",
The "cls" command clear the entire window and execute the lines just after the cls command.
The "exit" to close the bat file.
I think thats enough for a begginer.If you have any doubts ask in comments not in pm.
So first type these commands in the text file you created
Code:
@echo off
COLOR 0b
Title <YOUR TITLE FOR THE SOFTWARE>
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo One Click TWRP Recovery Installer for <DEVICE NAME>
echo -- TWRP Recovery image by <YOUR NAME>--
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo One Click Installer made by [url]www.YOUR[/url] WEB SITE.com
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo <any thing you like to display>
pause
cls
The pause is given to promt the user to press any key to continue
The "cls" to clear all the details printed after the key is pressed.
If you want to add blank lines type "echo." and hit enter.
Code:
adb devices
adb reboot bootloader
fastboot devices
fastboot erase cache
fastboot flash recovery [COLOR="Orange"]recovery file name[/COLOR].img
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo Installation successful!
echo Your device will now reboot automatically.
echo -----------------------------------------------------------
echo -----------------------------------------------------------
fastboot reboot
echo to close this window press any key..
pause
exit
I hope you may have some knowledge about the adb commands,so that i dont need to explain those again.
Once this is done save the file as "filename.bat" and save type to "All Files" from "Text Document".
Once agin to keep in mind this requires a phone with Unlocked bootloader and Make sure that "USB Debugging is enabled"
You can see the bat file i created with above codes and the text file i wrote in the attachment
If this helped you post you reply and thumbs up :laugh:
Great but please use "[ CODE][/ CODE]" to format the code parts in your text (like the following example). And take another look, there are some Typos.
Code:
This is how it looks formatted as code!
Keep it going
Deletescape
deletescape said:
Great but please use "[ CODE][/ CODE]" to format the code parts in your text (like the following example). And take another look, there are some Typos.
Code:
This is how it looks formatted as code!
Keep it going
Deletescape
Click to expand...
Click to collapse
Yeah thanks for the info. I will look into that today itself
Thanks
Ty, very useful.
caes95 said:
Ty, very useful.
Click to expand...
Click to collapse
you are
welcome
adithyan25 said:
Yeah thanks for the info. I will look into that today itself
Click to expand...
Click to collapse
I have changed as you suggested :victory: