RamJet is a small C daemon inspired by Rice/Ananicy. It scans /proc and applies
Ananicy-style .rules and .types definitions to process/thread priorities,
I/O priorities and OOM scores.
- PID cache: priorities are re-applied only when a process is new, gained
threads or the cache TTL expired (default 60 s), removing the bulk of
setpriority/ioprio_set/oom_score_adjsyscalls from every scan. - Bug fixes:
- rules with
nice: -1are applied (-1was used as an internal sentinel); - rules with only
ionicenow default to thebest-effortclass, like Ananicy; - executables replaced on disk (
(deleted)suffix) still match their rules; - dead processes (
ESRCH) no longer count as errors (no more warn spam); - repeated failures (e.g.
EPERMwithoutCAP_SYS_NICE) are logged once, not on every cycle; oom_score_adjuses rawwrite(2)and no longer leaks aFILE*.
- rules with
- Deterministic loading: config files are parsed in sorted path order, so
00-...files are reliably overridden by later files. Redefined rules/types and rules referencing undefined types are reported. - Runtime configuration:
/etc/ananicy.confis now actually read (check_freq,type_load,rule_load,apply_nice,apply_ionice,apply_oom_score_adj,log_applied_rule,loglevel). - SIGHUP reloads rules and types without restarting the daemon.
- CLI:
-c DIR,-f FILE,-t SECONDS,-T SECONDS,-l LEVEL,-n(dry run),-d(debug),-V,-h. - Dead code removed:
src/cJSON.c/src/cJSON.hwere never compiled.
Dependencies are only the C toolchain and Linux headers:
make
make testInstall the binary and the default configuration:
sudo make install # /usr/local/bin/ramjet + /etc/ananicy.d + /etc/ananicy.conf
sudo make install-bin # binary onlymake install never overwrites existing rules or types. To install under
another prefix (e.g. /usr), use make install PREFIX=/usr and adjust the
service files accordingly.
ramjet [OPTIONS]
-c DIR rules/types directory (default: /etc/ananicy.d)
-f FILE key=value config file (default: /etc/ananicy.conf)
-t SECONDS scan interval (default: 5)
-T SECONDS cache TTL, 0 disables the cache (default: 60)
-l LEVEL log level: debug, info, warn, error
-n dry run: log what would be applied, change nothing
-d shortcut for -l debug
Signals: SIGINT/SIGTERM stop the daemon, SIGHUP reloads the
configuration and flushes the PID cache.
Tip: ramjet -n -d -c /etc/ananicy.d shows exactly which rules would be
applied to which processes, which is handy to validate new rules.
/etc/ananicy.conf (key = value):
| key | default | meaning |
|---|---|---|
check_freq |
5 |
seconds between scans (0.01..86400) |
type_load / rule_load |
true |
load .types / .rules files |
apply_nice |
true |
apply nice values |
apply_ionice |
true |
apply I/O priorities |
apply_oom_score_adj |
true |
apply OOM score adjustments |
log_applied_rule |
false |
log every applied rule (debug) |
loglevel |
info |
trace, debug, info, warn, error, critical |
apply_latnice, apply_sched and cgroup keys are recognized but ignored
(RamJet does not manage scheduler policies nor cgroups).
Rules (/etc/ananicy.d/**/*.rules, one JSON object per line):
name— executable name (/proc/<pid>/exebasename)type— inherits fields from a type definitionnice(-20to19)io-classorioclass(realtime,best-effort,idle)ionice(0to7; without a class it defaults tobest-effort)oom_score_adj(-1000to1000, applied per process)
Files are loaded in sorted order; when a rule or type name is defined several times, the last definition wins and a warning is logged. Invalid field values are ignored with a warning instead of dropping the whole rule.
Each scan, a matched process is skipped when its pid + starttime are
already cached, it has not gained threads, and the cache has not expired.
Every cache_ttl seconds (default 60, -T 0 disables) the cache is rebuilt:
dead PIDs are dropped and every priority is re-applied, so external changes
(e.g. a manual renice) are corrected within the TTL.
Systemd:
sudo install -m 644 systemd/ramjet.service /etc/systemd/system/ramjet.service
sudo systemctl daemon-reload
sudo systemctl enable --now ramjet.serviceFor runit, place the runit/ directory under the appropriate service directory.
GPL-3.0, see LICENSE.