Help. Execute shell command @ startup - Samsung Epic 4G Touch

I have a shell command that I manually type in terminal everytime my phone starts up. How can I make it automatically execute @ each boot? I've seen init.d scripts, but I'm currently on ICS and I don't believe the kernel I am on supports init.d scripts yet. Any other way without using an external app?
thanks..

Check my thread out in here,
http://forum.xda-developers.com/showthread.php?t=1610741
You can run any scripts during the boot.

Related

[Q] how to auto run script on boot?

DooMKernel v10 with FW:4.0.A.2.368 on rogers xperia arc (bootloader unlocked)
I'm trying to use a custom script to set voltage, cpu governor, and schedule
I tried to copy the script to the sd card, then copy to /etc/init.d/, set permission to 777 in root explorer, NO EFFECT ON REBOOT..
Then I tried to use adb push to directly push the script into /etc/init.d/, and use chmod 777 command to set permission in adb shell, still NO EFFECT ON REBOOT..
If however I execute the script directly with root explorer everything works...
I've attached the script I used. Can anyone help me to autorun this on boot? Thx!!
zeronk said:
DooMKernel v10 with FW:4.0.A.2.368 on rogers xperia arc (bootloader unlocked)
I'm trying to use a custom script to set voltage, cpu governor, and schedule
I tried to copy the script to the sd card, then copy to /etc/init.d/, set permission to 777 in root explorer, NO EFFECT ON REBOOT..
Then I tried to use adb push to directly push the script into /etc/init.d/, and use chmod 777 command to set permission in adb shell, still NO EFFECT ON REBOOT..
If however I execute the script directly with root explorer everything works...
I've attached the script I used. Can anyone help me to autorun this on boot? Thx!!
Click to expand...
Click to collapse
Nice script.
It can't help you, but look at it:
http://forum.xda-developers.com/showthread.php?t=486486
You can use this for autostart and if you have trouble, simply remove SD card before start the phone:
http://forum.xda-developers.com/showthread.php?t=1011266

Init.d do not run

I am using the rom IML74K Android 4.0.3 Build 8 from bigxie and franco.Kernel #13.
I think the rom and kernel suppose to support init.d scripts. And I can found the script in etc/init.d named 97schedmc.
I wanna the hotplug function, so I put a file named 98hotplug(I don't know how to named the script), but I found it would not work. The parameter would not change after restart the device. Even I excute it(rename to sh file) in RootExplor, the parameter did not changed.
I try to run or sh the command in adb shell, it works fine, and the parameter changed.
I thinks it is relate to the access right issue, but I don't know how to fix it.
Could any one can help me?
Thanks for the guy who reply me.
you most chmod the files. Just sticking them it won't allow them to run.
I am not such understand... What should I do then?
chmod them?
755 works.
Hi,
Like this:
For 755,right permissions for scripts in Init.d folder,a good link i think: http://www.elated.com/articles/understanding-permissions/
Do not create a sh. file,for example in Root Eplorer,go to system/etc/init.d and menu/New file then put your script with #!/system/bin/sh first then space then enter.
Or on your pc take a init.d file in a rom,erase the script,copy yours with the correct script,reput in your phone,set the correct permissions then reboot.
Are you really sure your rom/kernel suppot Init.d ?
Just one question,I do not use this combo...
Hoping this helps
Permissions are set correctly, the kernel (faux123) supports init.d scripts, and the script works when run from terminal, but it still does not run on boot.
Thanks for your reply and great help!
I am sure the kernel support the init.d, but I not sure the rom, is it necessary both of them to support init.d?
What is your combo??
Hi,
To monkeyzou,yes i use the same kernel wich support Init.d script,but i use aokp rom,the rom you are using seems not support Init.d (it is not specified?),but in any case the Franco kernel support it,and it create the necessary lines in "init.rc" for activate the init.d support+the init.d file+the correct permissions,all automatically when you flash the kernel...
So i don't now what is wrong
Are you sure you set the right permissions for your file script in init.d?Are you sure your script is written correctly?
Can you share it?
After that my knowledges stop there,sorry...
init.d support only needs to be in the kernel ramdisk. As for rom support, that only goes as far as needing the directory. Note that some of the kernels out there are anykernel format and therefore would not support init.d scripts.
I was trying to do the exact same thing and couldn't make it work either. Eventually I just used Script Manager (on market) and let it run the script at boot.
Here is my script:
Code:
#!/system/xbin/bash
echo 1 > /sys/module/dsscomp/parameters/hotplug_enabled
Re,
To monkeyzou can you test this script at the bottom of my message?
Remove the .txt and copy it to your init.d folder then set the right permissions for it as i have shown above.
Or test another script where you could see a change?
At the end are you sure your script don't work?
After reboot with the script go to /sys/module/dsscomp/parameters/hotplug_enabled and see if the value is set to 1,if yes it's ok,if no (so set to 0),i don't know more...
ctbear said:
I was trying to do the exact same thing and couldn't make it work either. Eventually I just used Script Manager (on market) and let it run the script at boot.
Here is my script:
Code:
#!/system/xbin/bash
echo 1 > /sys/module/dsscomp/parameters/hotplug_enabled
Click to expand...
Click to collapse
Hi,
Test the script i've posted above:
#!/system/bin/sh
echo 1 > /sys/module/dsscomp/parameters/hotplug_enabled
Click to expand...
Click to collapse
I hope that helps
viking37 said:
Hi,
Test the script i've posted above:
I hope that helps
Click to expand...
Click to collapse
Thanks. Unfortunately it still didn't work, but I've found a workaround (looks stupid, but somehow works):
Basically I have a script file at the root of storage, and it contains just the echo line. My init script will just run that /sdcard script and it works fine.
viking37 said:
Re,
To monkeyzou can you test this script at the bottom of my message?
Remove the .txt and copy it to your init.d folder then set the right permissions for it as i have shown above.
Or test another script where you could see a change?
At the end are you sure your script don't work?
After reboot with the script go to /sys/module/dsscomp/parameters/hotplug_enabled and see if the value is set to 1,if yes it's ok,if no (so set to 0),i don't know more...
Click to expand...
Click to collapse
Tried this script and it works

adb not found

Hey there,
hopefully somebody can help me out here.
I tried to execute an .sh script which executes some adb commands. (kill-server / start-server). I sadly only get an "adb: not found" response.
Yes, ADP WIFI is enabled in Developer Settings. I also disabled and enabled and tried again. i also tried to execute adb command from "Android Terminal Emulator" App. That didnt work eighter. i am running 5.2.1.0 build. What am i doing wrong here?
You most likely need to put adb back onto the device. see here

How to run .sh scripts on Rooted Fire Device running rbox CFW

HERE'S THE ANSWER!
Let's say the script is on the /sdcard and named 'script.sh'. The script would be run like so....
Code:
adb connect
adb shell su
cd /sdcard/
sh ./script.sh
@rbox
I've been searching for a guide to run .sh scripts on my Fire Stick Gen1. I've found a couple guides on how to auto run scripts on boot...but I want to simply run a script on demand. Particularly, I'm trying to run a few of the debloat scripts offered inside "esc0rtd3w" FirePwn Amazon FireTV Stick Loader located at... https://github.com/esc0rtd3w/firestick-loader
To run a script on demand. Do I need to have the script in a specific location on the Fire device? Do I need to set permissions for the script? Does it matter what file extension the script has? Does it need .sh at the end of the filename? I noticed the autoboot script guides DO NOT have .sh at the end of the filenames for the scripts its auto running at boot.
I also have another question...
I want to try out esc0rtd3w's FirePwn Amazon FireTV Stick Loader. I downloaded his entire github repo and open the 'autorun.cmd' but it doesn't recognize my device. Does anyone know how to successfully connect to the FireTV Stick Gen1 with his script? I've tried adb connecting to my device and then running his script but it still doesn't recognize my device. Has anyone successfully utilized this tool? If so, how did you get it to recognize your device? Because I haven't been able to utilize his windows script to automate the plethora of tasks it offers, it led me to seek how to run .sh scripts manually.
I still CANNOT for the life of me, figure out how to run a script on the Fire TV through ADB. I'm using terminal on Linux, directly connected to a FireTV Stick Gen 2 with full root. I can manually execute the commands in the script but I cannot execute the script(s)! So here's one of the scripts I'm trying to run... Script Could someone explain to me, how would I execute this script via ADB?
Edit: I solved my issue! The text needs to be in unix format!! I used dos2linux to fix all the scripts and they go without a hitch. So I put all the scripts into a folder. I right clicked on that folder and clicked open terminal. I then executed this code to batch convert all files in the folder to unix format.
Code:
find . -type f -print0 | xargs -0 dos2unix

ADB debugging not working on reboot

I am running lineageOS on a rooted firestick. I am using ADB on the Firestick to control it via Homeassistant. The problem is that the adb debugging does not automatically work on reboot. Everytime i reboot i have to manually go to the menu turn off the ADB debugging and then turn in back on. After doing this i am able to reconnect adb via network (i.e, on homeassistant).
I want to ask is there any way i can use a script to automatically do this on restart of firestick. I have tried creating a script in init.d with the following contents but it doesn't seem to work.
adb tcpip 5555
I have added the following line to build.prop but this doesn't seem to work too
service.adb.tcp.port=5555
On restart the adb debugging is on in the developer tools but somehow it doesn't connect (either to Homeassistant or to my laptop), what seems to make it work is toggling it off and then back on.
Have you tried persist, so that the setting sticks between reboots?
Code:
ADB shell setprop persist.adb.tcp.port 5555
Just tried it. Still not working after reboot.
I there any command i can use to toggle the adb debugging via a startup script or crontab?
symbiansucks said:
Just tried it. Still not working after reboot.
I there any command i can use to toggle the adb debugging via a startup script or crontab?
Click to expand...
Click to collapse
Be sure you are running the above command as root user. Type su at the shell prompt, then type whoami to confirm you are root.
I guess you could make a script to run the following on each boot if the above doesn't work:
Code:
settings put global adb_enabled 1
setprop service.adb.tcp.port 5555
stop adbd
start adbd
exit 0
But I don't think this should be necessary.
Finnzz said:
Be sure you are running the above command as root user. Type su at the shell prompt, then type whoami to confirm you are root.
I guess you could make a script to run the following on each boot if the above doesn't work:
Code:
settings put global adb_enabled 1
setprop service.adb.tcp.port 5555
stop adbd
start adbd
exit 0
But I don't think this should be necessary.
Click to expand...
Click to collapse
Thanks. yes the command was run as root. Can i ask you one more thing, whats the best place to put the startup scripts in? I have tried init.d/ directory but the scripts don't get loaded from there i believe?
I have set permissions to chmod 755 for the script.
You can follow this guide,
Android (LineageOS 16) Execute Script on Start Up | sqall's blog
but it seems like there should be a much easier way to make ADB tcpip persist between reboots. I don't want to steer you wrong. @Sus_i would know better, he uses your build of LineageOS, and may have a cleaner solution.

Categories

Resources