termux / termux-boot

Termux add-on app allowing programs to be run at boot.
https://f-droid.org/en/packages/com.termux.boot
973 stars 224 forks source link

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

Open ravindersingh17 opened 5 years ago

ravindersingh17 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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.

On Sun, Jul 28, 2019, 8:29 AM justoke notifications@github.com wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/termux/termux-boot/issues/34?email_source=notifications&email_token=ACPQOXU6N4LVSAJCYZ5QWJ3QBW3M5A5CNFSM4HXFFY5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD27A4SQ#issuecomment-515771978, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPQOXUWZGOQHCRPGKMGLQ3QBW3M5ANCNFSM4HXFFY5A .

mrslezak commented 5 years ago

It would help me if someone knew how to run with tsu or the sudo package at boot. That I can't find documented anywhere. I've tried tsu outside opening a Termux shell but it just won't set permissions on root required mods (chmod + xyz echo > # chmod back to original format. Anyone have an idea?

On Sun, Jul 28, 2019, 9:20 PM Merith notifications@github.com wrote:

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.

On Sun, Jul 28, 2019, 8:29 AM justoke notifications@github.com wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/termux/termux-boot/issues/34?email_source=notifications&email_token=ACPQOXU6N4LVSAJCYZ5QWJ3QBW3M5A5CNFSM4HXFFY5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD27A4SQ#issuecomment-515771978 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ACPQOXUWZGOQHCRPGKMGLQ3QBW3M5ANCNFSM4HXFFY5A

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/termux/termux-boot/issues/34?email_source=notifications&email_token=AECPVRRFEXPVLMN5DO3Y5BDQBZHWVA5CNFSM4HXFFY5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD27M6RA#issuecomment-515821380, or mute the thread https://github.com/notifications/unsubscribe-auth/AECPVRQZZOF3FQIDANIBBE3QBZHWVANCNFSM4HXFFY5A .

justoke commented 5 years ago

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 commented 5 years ago

I believe they can have any extension BTW as long as you chmod +x the files

On Sun, Jul 28, 2019, 9:20 PM Merith notifications@github.com wrote:

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.

On Sun, Jul 28, 2019, 8:29 AM justoke notifications@github.com wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/termux/termux-boot/issues/34?email_source=notifications&email_token=ACPQOXU6N4LVSAJCYZ5QWJ3QBW3M5A5CNFSM4HXFFY5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD27A4SQ#issuecomment-515771978 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ACPQOXUWZGOQHCRPGKMGLQ3QBW3M5ANCNFSM4HXFFY5A

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/termux/termux-boot/issues/34?email_source=notifications&email_token=AECPVRRFEXPVLMN5DO3Y5BDQBZHWVA5CNFSM4HXFFY5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD27M6RA#issuecomment-515821380, or mute the thread https://github.com/notifications/unsubscribe-auth/AECPVRQZZOF3FQIDANIBBE3QBZHWVANCNFSM4HXFFY5A .

Merith-TK commented 5 years ago

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