Open Benjamin-Loison opened 5 days ago
ps aux | grep ' CROND -n -s$' | wc -l
237
1708 / 327 = 5.22
ps aux | grep ' jq .temperature$' | wc -l
123
ps aux | cat
helps seeing the actual whole line.
ps aux | grep ' /data/data/com.termux/files/usr/libexec/termux-api BatteryStatus$' | wc -l
237
ps aux | grep ' /data/data/com.termux/files/usr/bin/sh /data/data/com.termux/files/usr/bin/termux-battery-status$' | wc -l
237
well enumerating the processes is not very interesting should focus on solving one.
App info of Termux and Termux API do not seem to show possible background issues.
It seems that:
crontab -l
* * * * * (date && termux-battery-status | jq .temperature && cat /sys/class/thermal/thermal_zone*/temp 2> /dev/null) >> bens_folder/termux/temperature.txt
* * * * * (date && termux-battery-status) >> bens_folder/termux/battery.txt
are to blame.
time (date && termux-battery-status | jq .temperature && cat /sys/class/thermal/thermal_zone*/temp 2> /dev/null)
time (date && termux-battery-status)
so it is unclear why both kind of tasks are not executed right now at least as running one of each works fine quickly. Maybe could specify that if do not complete under a minute, then abort these jobs.
Both from htop
CPU% and MEM% (biggest one being com.termux
with 1.8) except significant values for NI and (-20) and VIRT (14.0G) I do not notice anything particular
time (timeout 3 sleep 5)
ps-check.sh
:crontab -l
...
* * * * * bens_folder/termux/ps-check.sh
After reboot ps aux | wc -l
returns 39.
So now let us wait.
timeout --help
* * * * * timeout 3 date >> dates.txt
works as wanted.
Problem description
Output:
``` #* * * * * THRESHOLD=200; NB=$(ps aux | wc -l); if [ $NB -gt $THRESHOLD ]; then termux-notification -t "ps aux is detected as reporting too many jobs ($NB compared to $THRESHOLD)"; fi #* * * * * cd bens_folder/termux/ && ./ps-check.py ... ```32 jobs after killing all idling
termux-battery-status
executions Note that executing this crontab may involve additional jobs.
: ```python #!/usr/bin/python3 import subprocess def execute(cmd): return subprocess.check_output(cmd, shell=True).decode('utf-8')[:-1] cmd = 'ps aux | wc -l' #cmd = 'ps aux | grep python3 | wc -l' result = execute(cmd) pythonInstances = int(result) n = 50 if pythonInstances > n: execute(f'termux-notification -t "More than {n} python instances have been detected"') ```ps-check.py
Steps to reproduce the behavior.
Not read.
What is the expected behavior?
No response
System information