termux / termux-boot

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

Termux Plugin Execution Command Error #76

Closed CasparNuel closed 2 years ago

CasparNuel commented 2 years ago

Problem description

I have created the ~/.termux/boot directory and placed my .sh file in there with chmod o+x,g+x,u+x script.sh to ensure there is no lack of permissions.

I have opened the Termux:Boot application multiple times at this point.

Steps to reproduce

cd ~ mkdir .termux/boot # write some working sh file here cp ./someworkingfile.sh ./.termux/boot/script.sh chmod o+x,g+x,u+x ./.termux/boot/script.sh

At this point, I get a screen with following information:

User action: Plugin execution command Sender: TermuxService

Execution Intent Command Previous State: Executing Current State: Failed Executable: /data/data/com.termux/files/home/.termux/boot/script.sh Arguments: - Working Directory: /data/data/com.termux/files/home inBackground: True isFailsafe: False Session Action: - isPluginExecutionCommand: True

Result PendingIntent Creator:

(all three fields have no value)

Error Code: 2 Error Message Failed to execute "(1000) Execution Intent Command" termux task command

First line of stack trace: java.io.IOException: Cannot run program "/data/data/com.termux/files/home/.termux/boot/script.sh" (in directory "/data/data/com.termux/files/home"): error=2, No such file or directory

But the file is there? Did I miss a step? Am I missing a vital package or setup?

Expected behavior

For the script to run at boot without error

When manually ran (sh script.sh) this script works perfectly.

Additional information

Grimler91 commented 2 years ago

write some working sh file here

What do you have in your sh file?

CasparNuel commented 2 years ago

Currently, just for testing:

#!data/data/com.termux/files/usr/bin/sh

echo "hi" >> /storage/emulated/0/hi.txt

However, I have changed the content three times now, even once using the Termux:API package to show a toast - the result is always the same.

And for each change, running the script manually sh script.sh works as expected.

CasparNuel commented 2 years ago

Found the issue:

#!data/data/com.termux/files/usr/bin/sh

Should be

#!/data/data/com.termux/files/usr/bin/sh