🔥 Preheat

Predict. Preload. Perform.

Adaptive readahead daemon for Linux

View on GitHub

API Reference

Command-line interface and signal reference for preheat.

Note: Preheat consists of two binaries:

  • preheat — The daemon that runs in the background and does the actual preloading
  • preheat-ctl — The control tool to manage, query, and configure the daemon

preheat Daemon

Synopsis

preheat [OPTIONS]

Description

Adaptive readahead daemon that learns application usage patterns and preloads predicted applications into memory.

Options

Option Long Form Argument Description
-c --conffile FILE Configuration file path
-s --statefile FILE State file path
-l --logfile FILE Log file path
-n --nice LEVEL Process nice level (0-19)
-f --foreground - Run in foreground (don’t daemonize)
-t --self-test - Run diagnostics and exit
-h --help - Show help and exit
-v --version - Show version and exit

Default Paths

File Default Location
Configuration /usr/local/etc/preheat.conf
State /usr/local/var/lib/preheat/preheat.state
Log /usr/local/var/log/preheat.log
PID /run/preheat.pid

Examples

Run normally (via systemd):

sudo systemctl start preheat

Run in foreground for debugging:

sudo preheat -f

Run with custom configuration:

sudo preheat -c /path/to/custom.conf

Run with custom state file:

sudo preheat -s /tmp/preheat-test.state

Run system diagnostics:

preheat --self-test

Exit Codes

Code Meaning
0 Normal exit (via signal)
1 Error (configuration, permissions, etc.)

preheat-ctl Control Tool

Synopsis

preheat-ctl COMMAND

Description

Command-line tool to control and query the running preheat daemon.

The status, mem, and predict commands work without root. Signal commands (reload, dump, save, stop) require root privileges.

Commands

status

Check if the daemon is running.

preheat-ctl status

Output (running):

preheat is running (PID 1234)

Output (not running):

preheat is not running

Exit codes:


reload

Reload configuration file without restarting.

sudo preheat-ctl reload

Effect:

Equivalent signal: SIGHUP


dump

Write state statistics to log file.

sudo preheat-ctl dump

Effect:

To view dumped data:

sudo tail -100 /usr/local/var/log/preheat.log

Equivalent signal: SIGUSR1


save

Force immediate state file save.

sudo preheat-ctl save

Effect:

Equivalent signal: SIGUSR2


stop

Stop the daemon gracefully.

sudo preheat-ctl stop

Effect:

Equivalent signal: SIGTERM


help

Display usage information.

preheat-ctl help

mem

Display system memory statistics.

preheat-ctl mem

Output:

Memory Statistics
=================
Total:       16384 MB
Free:         4000 MB
Available:    8000 MB
Buffers:       500 MB
Cached:       3500 MB

Usable for preloading: 8000 MB

No root required.


predict

Show top predicted applications from state file.

preheat-ctl predict
preheat-ctl predict --top 5

Output:

Top 10 Predicted Applications
=============================

 1. /usr/bin/firefox (run time: 45 sec)
 2. /usr/bin/code (run time: 30 sec)
...

Total tracked: 23 applications

No root required.


stats

Display preload statistics and hit rate.

sudo preheat-ctl stats

Output:

  Preheat Statistics
  ==================

  Uptime:       2h 30m
  Apps tracked: 45

  Preload Events:
    Total:   127
    Hits:    89
    Misses:  38

  Hit Rate:  70.1% (excellent)

Requires root (sends SIGUSR1 to daemon).


stats –verbose

Display extended statistics with detailed metrics.

sudo preheat-ctl stats --verbose
sudo preheat-ctl stats -v

Output includes:


promote

Add an application to the priority pool.

sudo preheat-ctl promote APP
sudo preheat-ctl promote firefox
sudo preheat-ctl promote /usr/bin/code

Effect:

Requires root.


demote

Move an application to the observation pool (blacklist).

sudo preheat-ctl demote APP
sudo preheat-ctl demote grep

Effect:

Requires root.


show-hidden

Display applications in the observation pool.

preheat-ctl show-hidden

Output:

Observation Pool Apps (hidden from stats):
==========================================

  /usr/bin/grep
  /usr/bin/cat
  /usr/bin/sed

Total: 3 apps

reset

Remove manual override for an application.

sudo preheat-ctl reset APP
sudo preheat-ctl reset firefox

Effect:

Requires root.


explain

Explain why an application is or isn’t being preloaded.

preheat-ctl explain APP
preheat-ctl explain firefox
preheat-ctl explain /usr/bin/code

Output includes:


health

Quick system health check with monitoring-friendly exit codes.

preheat-ctl health

Exit codes:

Output:

✅ EXCELLENT - Preheat is operating optimally

  Daemon:       Running (PID 1234)
  Hit Rate:     72.5% (excellent)
  Uptime:       2d 5h

  Status: All systems operational

Use cases:


pause

Temporarily pause preloading.

sudo preheat-ctl pause         # Default: 1 hour
sudo preheat-ctl pause 30m     # 30 minutes
sudo preheat-ctl pause 2h      # 2 hours
sudo preheat-ctl pause 1h30m   # 1 hour 30 minutes
sudo preheat-ctl pause until-reboot

Effect:

Requires root.


resume

Resume preloading after pause.

preheat-ctl resume

Effect:


export

Export learned patterns to JSON file.

sudo preheat-ctl export                    # Default: preheat-profile.json
sudo preheat-ctl export ~/backup.json       # Custom path

Use cases:

Requires root (reads state file).


import

Validate and display apps from export file.

preheat-ctl import                    # Default: preheat-profile.json
preheat-ctl import ~/backup.json       # Custom path

update

Update preheat to latest version.

sudo preheat-ctl update

Effect:

Requires root.


help

Display usage information.

preheat-ctl help

systemd Equivalents

preheat-ctl systemctl
status systemctl status preheat
reload systemctl reload preheat
stop systemctl stop preheat
(n/a) systemctl start preheat
(n/a) systemctl restart preheat

preheat-ctl provides faster, direct signal access for scripting.


Signal Reference

The preheat daemon responds to the following signals:

SIGHUP (1) - Reload

sudo kill -HUP $(cat /run/preheat.pid)
# Or: sudo preheat-ctl reload

Actions:

  1. Reload configuration file
  2. Reopen log file
  3. Continue with new settings

Use case: After editing configuration or for log rotation.


SIGUSR1 (10) - Dump State

sudo kill -USR1 $(cat /run/preheat.pid)
# Or: sudo preheat-ctl dump

Actions:

  1. Write statistics to log file
  2. Include tracked applications
  3. Include Markov chain summary

Use case: Debugging, monitoring, verifying operation.


SIGUSR2 (12) - Save State

sudo kill -USR2 $(cat /run/preheat.pid)
# Or: sudo preheat-ctl save

Actions:

  1. Save state to state file immediately
  2. Bypass autosave timer

Use case: Before shutdown, backup, or upgrade.


SIGTERM (15) - Graceful Shutdown

sudo kill -TERM $(cat /run/preheat.pid)
# Or: sudo preheat-ctl stop
# Or: sudo systemctl stop preheat

Actions:

  1. Stop monitoring loop
  2. Save state to file
  3. Clean up and exit

Use case: Normal shutdown.


SIGINT (2) - Interrupt

# Ctrl+C when running in foreground
sudo preheat -f
^C

Actions: Same as SIGTERM.


Log File Format

Location

/usr/local/var/log/preheat.log

Entry Format

[Day Mon DD HH:MM:SS YYYY] message

Common Log Messages

Startup:

[Mon Dec 15 10:00:00 2024] loading configuration from /usr/local/etc/preheat.conf
[Mon Dec 15 10:00:00 2024] loading state from /usr/local/var/lib/preheat/preheat.state
[Mon Dec 15 10:00:00 2024] preheat 1.0.1 started

Periodic scan:

[Mon Dec 15 10:00:20 2024] 47 running processes, 23 tracked applications

State operations:

[Mon Dec 15 11:00:00 2024] saving state to /usr/local/var/lib/preheat/preheat.state

Signals:

[Mon Dec 15 12:00:00 2024] SIGHUP received - reloading configuration
[Mon Dec 15 12:00:00 2024] SIGUSR1 received - dumping state
[Mon Dec 15 12:00:00 2024] SIGUSR2 received - saving state

Shutdown:

[Mon Dec 15 18:00:00 2024] Exit signal received (15) - shutting down
[Mon Dec 15 18:00:00 2024] freeing state memory begin

State File Format

Location

/usr/local/var/lib/preheat/preheat.state

Format

Binary format for efficient serialization. Contains:

Operations

Backup:

sudo cp /usr/local/var/lib/preheat/preheat.state /backup/preheat.state.bak

Reset (clear learned data):

sudo systemctl stop preheat
sudo rm /usr/local/var/lib/preheat/preheat.state
sudo systemctl start preheat

Restore:

sudo systemctl stop preheat
sudo cp /backup/preheat.state.bak /usr/local/var/lib/preheat/preheat.state
sudo systemctl start preheat

Note: State file format may change between major versions. Backup before upgrading.


systemd Service

Unit File

Location: /usr/lib/systemd/system/preheat.service

Commands

# Start
sudo systemctl start preheat

# Stop
sudo systemctl stop preheat

# Restart
sudo systemctl restart preheat

# Reload config
sudo systemctl reload preheat

# Enable at boot
sudo systemctl enable preheat

# Disable at boot
sudo systemctl disable preheat

# Check status
sudo systemctl status preheat

# View logs
sudo journalctl -u preheat
sudo journalctl -u preheat -f    # Follow

Previous Up Next
← Advanced Usage Documentation Index Troubleshooting →