-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Boot scripts not being automatically executed after boot #47
Comments
I am having this issue as well. I am trying to autostart an instance of node red. It seems to be acquiring the wake-lock properly, but then says 0 sessions. I would love to see a resolution to this. |
@Cjkeenan for node-red you need to fix the shebang of the node-red script. It will not start an actual terminal session though, termux-boot expects the command to finish (or continue in the background) |
interesting, is there a guide somewhere on how to fix this? I was just following the guide on Node-RED's own documentation for how to install on Android and they recommended autostarting via termux:boot |
@Cjkeenan after installing node-red you see that the first line (the shebang) of the node-red script is When you run An alternative fix would be to not rely on the shebang at all in the termux-boot script, instead of having something like #!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
node-red You can do #!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
node ~/node_modules/.bin/node-red # change path if you installed globally The prefixed |
Sweet that seems to have fixed it. I just copied the path from
Are there any issues with what I have done? |
It should not have any other side-effects |
yeah that was a typo on my part, it was actually usr in the script. Thank you for your help. |
Not sure if this issue is still alive but... I am running Android 10 on a Teclast M40. I have followed all the instructions and advice from this thread and from the original documentation. I won't bother with the details at this time... but termux:boot is simply not starting. I.e., all installed from f-droid, ran termux:boot (though there is no indication it does anything, other that show the instructions... Is this expected?), script is in ~/.termux/boot, executable permissions, etc... Reboot... there is no output from logcat, or in the log file (created from my script with "set -x; exec > ~/boot.log 2>&1". The script runs and creates the log when executed manually from termux shell. Has anyone gotten this to work on Android 10? If so, can you please advise... Many thanks! |
I have the same problem with termux:boot doesn't have a session so that I can't ssh to termux. And I found that use "am start -n com.termux/.HomeActivity" can open termux so there would have a session (if you don't unlock your phone, the notification would still be 0 session but there seems to have a session because I can ssh to termux in this situation. ). You can add it into your start scripts in ~/.termux/boot/ .
I think this is a general problem happening to any Android version because I meet it on Android 7.1. Pardon my bad English. |
I'm using Android 12 non-rooted and Termux boot works fine. You must do the scripts inside Termux and not device root of user storage which is easily lost understanding. The scripts will otherwise not be found. It should work on all devices. It just needs the script at the hard coded Termux app only path. (Clarification: rooted user can use but shouldn't; this is a app itself use only location path; users shouldn't touch it; app can touch it because its its own private storage location; so do it in Termux app to do it.) It could be that specific devices are blocking boot receiver or some other odd thing. You have to narrow that down. But if you do logcat verbose and filter to "termux" and wait, then termux boot should at least show up if the device is allowing the app to start on boot. If it starts on boot then it should have a message about no scripts or some other further info to go on. |
I have similar issues on my Android 7 phone with Termux-boot-Addon. First of all: If starting with Termux-Boot-Addon this one works:
This one not:
=> no sshd running (but notification shown with Termux Wakelock) (so first line of script was executed but not more). |
One more curious (on Android 10):
This one not (only pkill added):
|
@uwe-007 if you have enabled sshd at some point (
(The wiki needs to be updated) |
@Grimler91 |
@uwe-007 not sure, |
so, its the weirdest thing....it worked perfectly yesterday and i rebooted numerous times to test it. whats going on? |
** Edited after further testing **
Problem description
Scripts in ~/.termux/boot seem not being executed at boot ...
Is there anything i can do to troubleshoot?
Steps to reproduce
Expected behavior
Create/update the $HOME/date file after boot
Additional information
The text was updated successfully, but these errors were encountered: