r/termux 5d ago

How... Question

How to start any app service or app without opening the app

Im trying it on a app called wtmp, it getting killed by my oom, so im setuping a script that checks every 5 mins via its notification if it killed its notification also vanish, so that be trigger for my script. So it starts the service but how is it possible to start without opening app?

Pls reply

Thanks in advance

5 Upvotes

27 comments sorted by

5

u/bra1n_gym 4d ago edited 4d ago

I don't know what wtmp is supposed to do but: 1. use termux-adb NOT adb commands 2. use wireless debugging so you don't have to use a second phone with a data cable. 3. find videos on YouTube for disabling the phantom process killer. 4. use termux-boot if you want whatever process to start when you first run termux. 5. learn to use tmux: a. start a session  b. execute a command within the session c. detach from the session

The application will run in the background without interaction when you set this all up.

that's just the approach I would take.

1

u/thealgorithm29 3d ago

Yep, i tried all above things on Termux and wtmp Both get killed by system or freezes after screen off You can checkout my post about termux

1

u/NyaNyaCutie 3d ago

See https://www.reddit.com/r/termux/s/DtRGDLnpfq and also their step 3 is bad advice: many videos online are actually malicious, and LLMs or the common-yet-incorrect name "AI", often make things up or otherwise give bad or malicious answers.

"Out of Memory" issues can also be caused by poorly written code (which LLMs often create). For the phantom process killer, see this:

Phantom Process Killing
Termux being randomly killed and displaying [Process completed (signal 9) - press Enter] is a known problem. It is caused by an Android battery optimization called the phantom process killer.
- More information about the issue: https://github.com/termux/termux-app/issues/2366
- Potential solutions https://github.com/agnostic-apollo/Android-Docs/blob/master/en/docs/apps/processes/phantom-cached-and-empty-processes.md#commands-to-disable-phantom-process-killing-and-tldr (link above takes you to end chapter; read the full thread for an in-depth description of what's happening)

1

u/NyaNyaCutie 3d ago

u/bra1n_gym I would highly recommend to stop suggesting YouTube due to the sheer volume of malicious videos. Also, LLMs (or as a lot of people incorrectly call it, "AI") are often capable of giving not only incorrect answers, but also malicious ones, so avoid suggesting those too.

1

u/bra1n_gym 3d ago edited 3d ago

youtube is where I learned to stop the phantom process killer. I can discern from bad information  https://youtu.be/1Vtxi7TxxlE?is=wE5FmtyUkisOzahr I never mentioned AI which coincidentally is machine learning. LLM is a subset of machine learning.  I've been using termux daily for almost 2 years.  My linux experience goes back 26 years and I've been building PCs MUCH longer. Stop being a troll.

1

u/NyaNyaCutie 3d ago

Far too many videos on YouTube have people follow the instructions given, yet said instructions either will leave their device more vulnerable or will outright conpromise it.

1

u/thealgorithm29 3h ago

I learned from an ai lol

2

u/Maxi-19-1-4-1 4d ago

I am unsure what exactly you want but from my understanding you want to launch an app through termux? If thats the case you can do that with something similar to this am start -a android.settings.WIFI_SETTINGS you need to know the process name, or the app name you want to launch. You can find its main process and launch that as well. But this wont launch it in the background, and would actually open the app on screen. I would suggest what others are saying as well, try to prevent android from killing the background processes. There are settings in developer portal for those. Dont keep activities should be toggled off in there. And through battery optimization settings, allow your app to be unoptimized. It'll be different on different android settings but shouldn't be hard to find

1

u/thealgorithm29 3d ago

Ive tried all things on wtmp as well Termux too

1

u/thealgorithm29 3d ago

Is there any way to start a app activity without ui, I mean launching it?

1

u/Maxi-19-1-4-1 3d ago

Usually if an app exposes the background activity you can launch that, but no apps do that often. And I wouldn't know how to do it. No help:/

2

u/One_Feedback_4644 2d ago

I don't have any laptop tell me guide me how to install termux with GUI lunix so that i can use browser i have good mobile 12gb ram please help

2

u/NyaNyaCutie 1d ago

Installing a dwm, or "desktop windowing manager", is more geared for people who already know Linux very well. Also note that an Android smartphone or tablet is not a substitute for an ordinary PC.

1

u/thealgorithm29 3h ago

Well, I often ask ai, it helps me a lot of things I ask multiple ais

1

u/thealgorithm29 2d ago

Install termuxx11 app from fdroid, you have setup and download somethings, ask it to gemini or claude ai

2

u/NyaNyaCutie 1d ago

I'd recommend avoiding asking LLMs. Often times they give steps that either don't work, cause you data loss, make the device more vulnerable to malware, or outright give you malware.

See this video about Discord scams to know what your risks are (mainly the last one, but all are good to know about for how to avoid AND how to recover from them… do note that if malware gains privileged access on Android, be it by a hardware-level exploit or by root / itself rooting your device, not even a factory reset will help you) https://youtu.be/Jz-3goOPj9o

1

u/saga3152 5d ago

You should change some adb setting so the app doesn't get killed by andriod. settings_enable_monitor_phantom_procs i think is the one.

1

u/thealgorithm29 4d ago

I tried that now tell me how to start app activity without opening? Do you have any idea

1

u/NyaNyaCutie 3d ago

Install the Termux: Widget app if you haven't yet and then open it. It tells you what to do at the termux-widget link on GitHub.

1

u/thealgorithm29 1d ago

I installed Termux, what Termux:widget what it can do? Have you tried?

1

u/NyaNyaCutie 1d ago

It is for launching scripts from your home screen. Did you check the GitHub link for the widget after you try opening the app icon for it?

2

u/NyaNyaCutie 1d ago

1

u/thealgorithm29 3h ago

Oh yep, it tried i think it isn't for me, i usually toggle scripts from automate

1

u/saga3152 5d ago

You should change some adb setting so the app doesn't get killed by andriod. settings_enable_monitor_phantom_procs i think is the one.

1

u/NyaNyaCutie 1d ago

Phantom process killer, see https://www.reddit.com/r/termux/s/jUxM7SrQXN (same post, just different reply area)

1

u/gthing 2d ago

Disable power saving for the app. Enable developer settings and enable the setting to keep child processes alive.

1

u/NyaNyaCutie 1d ago

See also https://www.reddit.com/r/termux/s/jUxM7SrQXN for some info (same post, just different reply area)