remove CLI options
This commit is contained in:
parent
e62629d57d
commit
dc1bdddb6f
26
README.md
26
README.md
@ -59,26 +59,18 @@ To use `PSI` (pressure stall information):
|
|||||||
|
|
||||||
## Memory and CPU usage
|
## Memory and CPU usage
|
||||||
|
|
||||||
- VmRSS is 10 — 11 MiB depending on the settings
|
- VmRSS is about 10 MiB
|
||||||
- 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 the user via the config)
|
- 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 the user via the config)
|
||||||
|
|
||||||
## Download, install, uninstall
|
## Download, install, uninstall
|
||||||
|
|
||||||
**Please use the latest [release version](https://github.com/hakavlad/nohang/releases).**
|
Please use the latest [release version](https://github.com/hakavlad/nohang/releases). Current version may unstable.
|
||||||
Current version may be more unstable.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git clone https://github.com/hakavlad/nohang.git
|
$ git clone https://github.com/hakavlad/nohang.git
|
||||||
$ cd nohang
|
$ cd nohang
|
||||||
```
|
```
|
||||||
|
|
||||||
Run without installing (low memory warnings may not work; note that processes with UID != your UID will not receive signals if nohang is started as a regular user):
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ./nohang
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
To install:
|
To install:
|
||||||
```bash
|
```bash
|
||||||
$ sudo make install
|
$ sudo make install
|
||||||
@ -97,19 +89,6 @@ $ sudo make uninstall
|
|||||||
For Arch Linux, there's an [AUR package](https://aur.archlinux.org/packages/nohang-git/). Use your favorite [AUR helper](https://wiki.archlinux.org/index.php/AUR_helpers).
|
For Arch Linux, there's an [AUR package](https://aur.archlinux.org/packages/nohang-git/). Use your favorite [AUR helper](https://wiki.archlinux.org/index.php/AUR_helpers).
|
||||||
|
|
||||||
|
|
||||||
## Command line options
|
|
||||||
|
|
||||||
```
|
|
||||||
./nohang -h
|
|
||||||
usage: nohang [-h] [-c CONFIG]
|
|
||||||
|
|
||||||
optional arguments:
|
|
||||||
-h, --help show this help message and exit
|
|
||||||
-c CONFIG, --config CONFIG
|
|
||||||
path to the config file, default values:
|
|
||||||
./nohang.conf, /etc/nohang/nohang.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to configure nohang
|
## How to configure nohang
|
||||||
|
|
||||||
The program can be configured by editing the [config file](https://github.com/hakavlad/nohang/blob/master/nohang.conf). The configuration includes the following sections:
|
The program can be configured by editing the [config file](https://github.com/hakavlad/nohang/blob/master/nohang.conf). The configuration includes the following sections:
|
||||||
@ -205,6 +184,7 @@ Please create [issues](https://github.com/hakavlad/nohang/issues). Use cases, fe
|
|||||||
- Add `oom-trigger`
|
- Add `oom-trigger`
|
||||||
- Adoption of the [code of conduct](https://github.com/hakavlad/nohang/blob/master/CODE_OF_CONDUCT.md)
|
- Adoption of the [code of conduct](https://github.com/hakavlad/nohang/blob/master/CODE_OF_CONDUCT.md)
|
||||||
- Redesign of the config
|
- Redesign of the config
|
||||||
|
- Remove CLI options
|
||||||
- Remove self-defense options from config, use systemd unit scheduling instead
|
- Remove self-defense options from config, use systemd unit scheduling instead
|
||||||
- Add the ability to send any signal instead of SIGTERM for processes with certain names
|
- Add the ability to send any signal instead of SIGTERM for processes with certain names
|
||||||
|
|
||||||
|
19
nohang
19
nohang
@ -2,13 +2,18 @@
|
|||||||
"""A daemon that prevents OOM in Linux systems."""
|
"""A daemon that prevents OOM in Linux systems."""
|
||||||
from time import sleep, time
|
from time import sleep, time
|
||||||
|
|
||||||
start_time = time()
|
# start_time = time()
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
# this is most slow import
|
# this is most slow import
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
from signal import SIGKILL, SIGTERM, SIGSTOP, SIGCONT
|
from signal import SIGKILL, SIGTERM, SIGSTOP, SIGCONT
|
||||||
@ -26,8 +31,8 @@ else:
|
|||||||
|
|
||||||
wait_time = 14
|
wait_time = 14
|
||||||
|
|
||||||
max_sleep_time = 1
|
max_sleep_time = 2
|
||||||
min_sleep_time = 0.02
|
min_sleep_time = 0.1
|
||||||
|
|
||||||
notify_helper_path = '/usr/bin/nohang_notify_helper'
|
notify_helper_path = '/usr/bin/nohang_notify_helper'
|
||||||
|
|
||||||
@ -37,7 +42,7 @@ psi_support = os.path.exists(psi_path)
|
|||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
|
|
||||||
stop_cont = True
|
stop_cont = False
|
||||||
print_states_debug = False
|
print_states_debug = False
|
||||||
|
|
||||||
|
|
||||||
@ -1035,7 +1040,7 @@ except ValueError:
|
|||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
'''
|
||||||
# Configurations
|
# Configurations
|
||||||
|
|
||||||
|
|
||||||
@ -1088,9 +1093,11 @@ else:
|
|||||||
print("File {} doesn't exists{}".format(
|
print("File {} doesn't exists{}".format(
|
||||||
arg_config, conf_err_mess))
|
arg_config, conf_err_mess))
|
||||||
exit()
|
exit()
|
||||||
|
'''
|
||||||
|
|
||||||
|
config = '/etc/nohang/nohang.conf'
|
||||||
|
|
||||||
print('The path to the config:', config)
|
print('Config:', config)
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
24
nohang.1
24
nohang.1
@ -7,16 +7,16 @@ nohang \- no hang daemon
|
|||||||
.RB [ OPTION ]...
|
.RB [ OPTION ]...
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
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
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.SH HOW TO CONFIGURE
|
||||||
|
|
||||||
|
Just edit config /etc/nohang/nohang.conf and restart the daemon.
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
|
||||||
|
https://github.com/hakavlad/nohang
|
||||||
|
|
||||||
|
|
||||||
.SH OPTIONS
|
|
||||||
.TP
|
|
||||||
.BI \-c " CONFIG",
|
|
||||||
.BI \-\-config " CONFIG"
|
|
||||||
path to the config file, default values:
|
|
||||||
.I ./nohang.conf,
|
|
||||||
.I /etc/nohang/nohang.conf
|
|
||||||
.TP
|
|
||||||
.BI \-h,
|
|
||||||
.BI \-\-help
|
|
||||||
show help message and exit
|
|
||||||
|
Loading…
Reference in New Issue
Block a user