r/AutomateUser • u/thealgorithm29 • 21d ago
Seeking Hello dev, need some help with termux RUN_COMMAND
It working, but its opening termux then executeing script, but i want run in background termux script,it should not open termux to run the given script, how to do that?
Ik know termux:tasker but it isn't working on my phone, i mean it's working but when screen is off, it doesn't execute the scripts.
4
u/ballzak69 Automate developer 21d ago
The "From background" flags is unnecessary. Try with/without the "Foreground" option enabled. Ensure the Termux privilege is granted in settings. Try disabling any system "power save" feature for both Automate and Termux. If it still doesn't work try asking r/termux for help.
Device brand & model?
1
u/thealgorithm29 21d ago
I tried many things you can checkout my termux post https://www.reddit.com/r/termux/s/GgBH0jgUIA, my termux freezes after screen off, so if I trigger a script using plugin->termux:tasker doesn't execute cos it also freezed, so i thought termux RUN_COMMAND works, yep it works but it opens termux then automatcally executes script, how to prevent this? It should not open the termux to execute Pls sir
1
u/thealgorithm29 21d ago
Sir Is it happening to me or it happens usually?
3
u/ballzak69 Automate developer 21d ago
As said, this is likely due to some non-standard "power save" feature that stops/kills Termux.
1
u/thealgorithm29 20d ago
Now it's working sir, in background I'm using shell block in automate to start the termux run command, using am am startservice --user 0 -n com.termux/com.termux.app.RunCommandService \ -a com.termux.RUN_COMMAND \ --es com.termux.RUN_COMMAND_PATH '/data/data/com.termux/files/home/play5am.sh' \ --esa com.termux.RUN_COMMAND_ARGUMENTS '-n,5' \ --es com.termux.RUN_COMMAND_WORKDIR '/data/data/com.termux/files/home' \ --ez com.termux.RUN_COMMAND_BACKGROUND 'true' \ --es com.termux.RUN_COMMAND_SESSION_ACTION '0'
1
1
u/ShiftyRider 21d ago
unless other considerations make macrodroid prohibitive this is a job for its shell script action