Problem description
Despite enabling termux-wake-lock, setting battery optimization to "Unrestricted", and pinning the app in the recent apps menu, the Android 15 system consistently kills long-running processes (e.g., yt-dlp monitors, bash loops) shortly after the application is sent to the background. The system treats the Termux process as a standard background activity and aggressively terminates it, making it impossible to perform automated tasks or maintain CLI sessions active. It seems that even with the active wake-lock notification, the OS kernel is overriding it and terminating the application to reclaim memory/battery.
Steps to reproduce the behavior.
Install yt-dlp in Termux (pkg install python yt-dlp).
Run a command that runs indefinitely, e.g.:
nohup bash -c "while true; do sleep 60; done" &
Use termux-wake-lock.
Minimize the Termux app and continue using the phone.
After a period of time, return to Termux and run pgrep -f "bash".
The process will no longer be listed, indicating it was killed by the system.
What is the expected behavior?
The process should persist in the background indefinitely while termux-wake-lock is active, allowing for reliable task automation and monitoring without the OS forcing an exit.
System information
- Termux application version: 0.119.0-beta.3
- Android OS version: 15
- Device model: Motorola moto g15
Problem description
Despite enabling termux-wake-lock, setting battery optimization to "Unrestricted", and pinning the app in the recent apps menu, the Android 15 system consistently kills long-running processes (e.g., yt-dlp monitors, bash loops) shortly after the application is sent to the background. The system treats the Termux process as a standard background activity and aggressively terminates it, making it impossible to perform automated tasks or maintain CLI sessions active. It seems that even with the active wake-lock notification, the OS kernel is overriding it and terminating the application to reclaim memory/battery.
Steps to reproduce the behavior.
Install yt-dlp in Termux (pkg install python yt-dlp).
Run a command that runs indefinitely, e.g.:
nohup bash -c "while true; do sleep 60; done" &
Use termux-wake-lock.
Minimize the Termux app and continue using the phone.
After a period of time, return to Termux and run pgrep -f "bash".
The process will no longer be listed, indicating it was killed by the system.
What is the expected behavior?
The process should persist in the background indefinitely while termux-wake-lock is active, allowing for reliable task automation and monitoring without the OS forcing an exit.
System information