fix logging: flush stdout
This commit is contained in:
parent
5ca9f249b1
commit
2cca1e9975
@ -50,7 +50,7 @@ Also look at [Why are low memory conditions handled so badly?](https://www.reddi
|
||||
|
||||
## Memory and CPU usage
|
||||
|
||||
- VmRSS is 10 — 14 MiB depending on the settings
|
||||
- VmRSS is 10 — 13 MiB depending on the settings (about 10 MiB by default)
|
||||
- CPU usage depends on the level of available memory (the frequency of memory status checks increases as the amount of available memory decreases) and monitoring intensity (can be changed by user via config)
|
||||
|
||||
## Status
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
1. Memory levels to respond to as an OOM threat
|
||||
|
||||
mem_min_sigterm = 9 %
|
||||
mem_min_sigkill = 6 %
|
||||
swap_min_sigterm = 9 %
|
||||
swap_min_sigkill = 6 %
|
||||
mem_min_sigterm = 10 %
|
||||
mem_min_sigkill = 5 %
|
||||
swap_min_sigterm = 10 %
|
||||
swap_min_sigkill = 5 %
|
||||
zram_max_sigterm = 50 %
|
||||
zram_max_sigkill = 55 %
|
||||
|
||||
@ -29,7 +29,7 @@ min_badness = 10
|
||||
min_delay_after_sigterm = 0.5
|
||||
min_delay_after_sigkill = 3
|
||||
decrease_oom_score_adj = False
|
||||
oom_score_adj_max = 20
|
||||
oom_score_adj_max = 30
|
||||
|
||||
#####################################################################
|
||||
|
||||
@ -48,7 +48,7 @@ avoid_factor = 3
|
||||
SIGTERM signal.
|
||||
|
||||
execute_the_command = False
|
||||
** processname :: some command
|
||||
$ETC proc_name /// some command
|
||||
|
||||
#####################################################################
|
||||
|
||||
|
9
nohang
9
nohang
@ -6,7 +6,7 @@ import os
|
||||
from operator import itemgetter
|
||||
from time import sleep, time
|
||||
from argparse import ArgumentParser
|
||||
# from subprocess import Popen
|
||||
from sys import stdout
|
||||
|
||||
sig_dict = {9: 'SIGKILL', 15: 'SIGTERM'}
|
||||
|
||||
@ -457,8 +457,7 @@ else:
|
||||
exit()
|
||||
|
||||
|
||||
print('The path to the config file to be used:')
|
||||
print(config)
|
||||
print('The path to the config file to be used:', config)
|
||||
|
||||
##########################################################################
|
||||
|
||||
@ -1252,7 +1251,7 @@ warn_time_now = 0
|
||||
warn_time_delta = 1000
|
||||
warn_timer = 0
|
||||
|
||||
print('\nStart monitoring...')
|
||||
print('Start monitoring...')
|
||||
|
||||
##########################################################################
|
||||
|
||||
@ -1431,7 +1430,7 @@ while True:
|
||||
|
||||
# SLEEP BETWEEN MEM CHECKS
|
||||
else:
|
||||
|
||||
stdout.flush()
|
||||
sleep_after_check_mem()
|
||||
|
||||
|
||||
|
2
nohang.1
2
nohang.1
@ -7,7 +7,7 @@ nohang \- no hang daemon
|
||||
.RB [ OPTION ]...
|
||||
|
||||
.SH DESCRIPTION
|
||||
Nohang is a highly configurable daemon for Linux which is able to correctly prevent out of memory conditions. See https://github.com/hakavlad/nohang
|
||||
Nohang is a highly configurable daemon for Linux which is able to correctly prevent out of memory (OOM) and keep system responsiveness in low memory conditions. See https://github.com/hakavlad/nohang
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
|
14
nohang.conf
14
nohang.conf
@ -34,13 +34,13 @@
|
||||
|
||||
MemAvailable levels.
|
||||
|
||||
mem_min_sigterm = 9 %
|
||||
mem_min_sigkill = 6 %
|
||||
mem_min_sigterm = 10 %
|
||||
mem_min_sigkill = 5 %
|
||||
|
||||
SwapFree levels.
|
||||
|
||||
swap_min_sigterm = 9 %
|
||||
swap_min_sigkill = 6 %
|
||||
swap_min_sigterm = 10 %
|
||||
swap_min_sigkill = 5 %
|
||||
|
||||
Specifying the total share of zram in memory, if exceeded the
|
||||
corresponding signals are sent. As the share of zram in memory
|
||||
@ -114,7 +114,7 @@ decrease_oom_score_adj = False
|
||||
|
||||
Valid values are integers from the range [0; 1000].
|
||||
|
||||
oom_score_adj_max = 20
|
||||
oom_score_adj_max = 30
|
||||
|
||||
#####################################################################
|
||||
|
||||
@ -275,7 +275,7 @@ oom_score_adj = -100
|
||||
Read `man ionice` to understand the following parameters.
|
||||
Setting the True value requires the root privileges.
|
||||
|
||||
realtime_ionice = True
|
||||
realtime_ionice = False
|
||||
|
||||
'For realtime and best-effort, 0-7 are valid data
|
||||
(priority levels), and 0 represents the highest priority level.'
|
||||
@ -291,7 +291,7 @@ realtime_ionice_classdata = 5
|
||||
Display the configuration when the program starts.
|
||||
Valid values are True and False.
|
||||
|
||||
print_config = True
|
||||
print_config = False
|
||||
|
||||
Print memory check results or not print.
|
||||
Valid values are True and False.
|
||||
|
@ -5,10 +5,6 @@ After=sysinit.target
|
||||
Documentation=man:nohang(1) https://github.com/hakavlad/nohang
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
ExecStart=/usr/local/bin/nohang
|
||||
|
||||
[Install]
|
||||
|
Loading…
Reference in New Issue
Block a user