Skip to content
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

termux-boot scripts do not execute on termux-boot version 0.5 #34

Open
ravindersingh17 opened this issue Jun 12, 2019 · 10 comments
Open

Comments

@ravindersingh17
Copy link

I have added a shell script in "/data/data/com.termux/files/home/.termux/boot" called "start-sshd" with the correct interpreter and +x permissions, but the script is not executed at startup, nor is any error reported in the logs.

For debugging I took out everything in the script and just left in an output to file statement like this:

termux-wake-lock
echo "fooo " >> $HOME/a1.log

But there is no file "a1.log" generated in the home directory. When I inspect the logs with logcat -s termux:*. the only entries I see are:

--------- beginning of system
--------- beginning of main

The termux-boot process is started on the phone(As listed in Phone settings>Apps), how can I get more information on why it is failing to execute the script. Here is information about my phone from termux-info:

Updatable packages:
dpkg/stable 1.19.7 arm [upgradable from: 1.19.6]
gpgv/stable 2.2.16 arm [upgradable from: 2.2.15-3]
libcurl/stable 7.65.1 arm [upgradable from: 7.65.0]
libiconv/stable 1.16-1 arm [upgradable from: 1.16]
openssl/stable 1.1.1c arm [upgradable from: 1.1.1b-3]
Subscribed repositories:
https://dl.bintray.com/grimler/science-packages-24 science/stable
https://dl.bintray.com/grimler/game-packages-24 games/stable
https://dl.bintray.com/termux/termux-packages-24 stable/main
System information:
Linux localhost 3.18.35 #1 SMP PREEMPT Mon Nov 20 18:22:56 CST 2017 armv7l Android
Termux-packages arch:
arm
Android version:
7.0
Device manufacturer:
LAVA
Device model:
Z60
@mrslezak
Copy link

I have the same issue gave up instructions are not clear at all. I tried putting in a new /com.termux/boot/myscript.rc per instructions (? Totally unclear instructions) and nothing happens at all....

@ghost
Copy link

ghost commented Jun 22, 2019

instructions are not clear at all

Instructions are:

  1. Install the Termux:Boot app.
  2. Start the Termux:Boot app once by clicking on its launcher icon. This allows the app to be run at boot.
  3. Create the ~/.termux/boot/ directory.
  4. Put scripts you want to execute inside the ~/.termux/boot/ directory. If there are multiple files, they will be executed in a sorted order.

What is not clear here ?

/com.termux/boot/myscript.rc

Wrong directory. Should be exactly ~/.termux/boot.

@mrslezak
Copy link

mrslezak commented Jun 22, 2019

Yes I setup the script as you mentioned still won't run on boot. I can copy / paste the code from the sh file into a Termux SU or TSU terminal it runs fine. Just the on boot won't work. Does it need a sleep 30 or something added?

The bizzare thing is I got the normal unprivileged terminal to run it with a chmod 777 which runs su in the .sh file. I could do the same from an su session.

Then after rebooting none will run, su run before or not! What is going on. Worked in Widget and Terminal before a reboot ./script.rc. Even restored the exact file copies that worked. It still works if the code from the rc file is pasted into a Termux terminal, just not run as a script from the terminal. Is there another way to run other than ./script.rc?

@Merith-TK
Copy link

Im having this same issue on my tablet, my startup scripts are not starting on boot like they are supposed to, i ahve sect them up according to the instructions, both apps are installed from f-droid and up2date

@justoke
Copy link

justoke commented Jul 28, 2019

The instructions are probably obvious to people who know this inside out. If you are just following this as a how to format, then it is a bit light on detail. The Step 3. Create the ~/.termux/boot/ directory is what got me. Where exactly is ~/ ? As the termux terminal is nested in a fairly deep folder structure.

Try these commands after starting termux terminal:
pwd
/data/data/com.termux/files/home - if this is not where you find yourself, change to this path and then proceed as follows:

//Create the directories needed
mkdir .termux
mkdir .termux/boot
cd .termux/boot
//this creates an empty file
touch start.sh    
chmod +x start.sh
//Edit the file to add your start up commands - I used nano editor like so
nano start.sh

After editing and saving the file, try restarting your device. And then run this command to see if it worked:

logcat -s termux:*
//Should return something like:
07-28 15:53:08.742 1617 1617 T termux   : Executed files at boot: start.sh //your file names should be seen  

Once you have got the files getting executed at boot the next step is to check that they are actually doing what you need them to. Hope this helps someone.

@Merith-TK
Copy link

Merith-TK commented Jul 29, 2019 via email

@mrslezak
Copy link

mrslezak commented Jul 29, 2019 via email

@justoke
Copy link

justoke commented Jul 29, 2019

I am a heavy Linux user, Do the files Have to have the .sh extension? If so that may be where I'm messing up.

That is what worked for me, but having the files in the right location is essential.

@mrslezak
Copy link

mrslezak commented Jul 29, 2019 via email

@Merith-TK
Copy link

they are in the right spot with the right perms, think it might be a android 8.1/9/pie problem?

@termux termux deleted a comment from bhagwandassony1 Aug 5, 2020
@termux termux deleted a comment from bhagwandassony1 Aug 5, 2020
@termux termux deleted a comment from bhagwandassony1 Aug 5, 2020
@termux termux deleted a comment from bhagwandassony1 Aug 5, 2020
@ghost ghost deleted a comment from jibon5221 Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants