CLI Commands
articwake provides a simple CLI with two main commands.
Running the Server
Section titled “Running the Server”articwakeStarts the HTTP server with configuration from environment variables.
Example
Section titled “Example”export ARTICWAKE_HOMELAB_MAC="aa:bb:cc:dd:ee:ff"export ARTICWAKE_HOMELAB_IP="192.168.1.100"./articwakeOutput:
2024-01-15T10:30:00.000Z INFO articwake: Starting articwake server2024-01-15T10:30:00.001Z INFO articwake: Listening on 127.0.0.1:80Environment Variables
Section titled “Environment Variables”See Environment Variables for all configuration options.
Hashing a PIN
Section titled “Hashing a PIN”echo -n "your-pin" | articwake hash-pinReads a PIN from stdin and outputs an Argon2id hash suitable for the pin.hash file.
Example
Section titled “Example”echo -n "1234" | ./articwake hash-pinOutput:
$argon2id$v=19$m=19456,t=2,p=1$randomsalthere$hashedoutputhereSave to File
Section titled “Save to File”echo -n "your-pin" | ./articwake hash-pin > pin.hashInteractive Input
Section titled “Interactive Input”For more secure input (no PIN in shell history):
read -s -p "Enter PIN: " PIN && echo -n "$PIN" | ./articwake hash-pin > pin.hashExit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 | Success |
1 | Configuration error (missing required env vars) |
1 | File access error (can’t read key or PIN hash) |
Logging
Section titled “Logging”articwake uses structured logging via tracing. Log level is controlled by the RUST_LOG environment variable:
# Default (info level)./articwake
# Debug loggingRUST_LOG=debug ./articwake
# Trace logging (very verbose)RUST_LOG=trace ./articwake
# Specific moduleRUST_LOG=articwake::auth=debug ./articwakeLog Format
Section titled “Log Format”2024-01-15T10:30:00.000Z INFO articwake::api::auth: Authentication attempt ip=192.168.1.1002024-01-15T10:30:00.001Z INFO articwake::api::auth: Authentication successfulSignal Handling
Section titled “Signal Handling”articwake handles standard Unix signals:
| Signal | Behavior |
|---|---|
SIGTERM | Graceful shutdown |
SIGINT (Ctrl+C) | Graceful shutdown |
Running as a Service
Section titled “Running as a Service”systemd
Section titled “systemd”Create /etc/systemd/system/articwake.service:
[Unit]Description=articwake Wake-on-LAN and LUKS unlock serviceAfter=network.target
[Service]Type=simpleUser=rootEnvironmentFile=/etc/articwake/config.envExecStart=/usr/local/bin/articwakeRestart=alwaysRestartSec=5
[Install]WantedBy=multi-user.targetEnable and start:
sudo systemctl enable articwakesudo systemctl start articwakeOpenRC (Alpine)
Section titled “OpenRC (Alpine)”The SD card image includes an OpenRC init script. To manage manually:
# Startrc-service articwake start
# Stoprc-service articwake stop
# Statusrc-service articwake status
# Enable on bootrc-update add articwake default