{
  "protocol": "kkokk-ago-twin-v5",
  "type": "pillar_guide",
  "site": "143",
  "domain": "makerskorean.net",
  "slug": "systemd-timer-flock-autonomous-ops",
  "lang": "en",
  "canonical_url": "https://makerskorean.net/en/blueprints/systemd-timer-flock-autonomous-ops/",
  "language_urls": {
    "ko": "https://makerskorean.net/blueprints/systemd-timer-flock-autonomous-ops/",
    "en": "https://makerskorean.net/en/blueprints/systemd-timer-flock-autonomous-ops/",
    "ja": "https://makerskorean.net/ja/blueprints/systemd-timer-flock-autonomous-ops/",
    "zh": "https://makerskorean.net/zh/blueprints/systemd-timer-flock-autonomous-ops/",
    "es": "https://makerskorean.net/es/blueprints/systemd-timer-flock-autonomous-ops/"
  },
  "published_at": "2026-11-26",
  "updated_at": "2026-11-30",
  "title": "Replacing Crontab with systemd.timer + flock Mutex for Bulletproof Batch Ops",
  "summary": "Eliminating crontab race conditions and silent failures with systemd oneshot units, fcntl.flock file locks, CPU/IO niceness, and JSONL audit trails.",
  "tldr": "Eliminating crontab race conditions and silent failures with systemd oneshot units, fcntl.flock file locks, CPU/IO niceness, and JSONL audit trails. [Scheduler: kkokk-v4-daily.timer (00:10 KST) · Concurrency Mutex: fcntl.flock file lock · Resource Guard: Nice=10, TimeoutStartSec=600]",
  "sections": [
    {
      "heading": "1. Technical Deep Dive & Measured Mechanism",
      "body": "Unlike bare crontab entries, systemd timers integrate cleanly with journalctl, wait for network-online.target, enforce execution timeouts, and prevent overlapping timer triggers."
    },
    {
      "heading": "2. Technical Deep Dive & Measured Mechanism",
      "body": "Because builds can be triggered both by the 00:10 timer and on-demand via 00admin APIs, run_pipeline.py acquires an OS-level fcntl.flock lock on /tmp/kkokk_v4_pipeline.lock so concurrent invocations never corrupt dist/."
    },
    {
      "heading": "3. Technical Deep Dive & Measured Mechanism",
      "body": "Running batch builds at Nice=10 keeps interactive web APIs snappy, while appending structured run summaries to logs/pipeline.jsonl provides an immutable operational ledger."
    },
    {
      "heading": "4. Field Verification Checklist, Pitfall Prevention & Continuous Audit",
      "body": "Deploying this workflow across KKOKK+W (makerskorean.net) proved that the most reliable engineering discipline is 'record baseline -> adjust one variable at a time -> run automated smoke verification'. Changing multiple parameters simultaneously obscures root causes. Use the benchmark matrix below as your starting reference, tune incrementally for your specific hardware, and re-verify latency, memory footprint, and 0.00 CLS stability after every change."
    }
  ],
  "metrics": [
    [
      "Scheduler",
      "kkokk-v4-daily.timer (00:10 KST)",
      "Persistent=true catch-up enabled"
    ],
    [
      "Concurrency Mutex",
      "fcntl.flock file lock",
      "Zero timer vs API race conditions"
    ],
    [
      "Resource Guard",
      "Nice=10, TimeoutStartSec=600",
      "Prevents runaway processes"
    ],
    [
      "Audit Trail",
      "logs/pipeline.jsonl",
      "Tracks duration, pages & status"
    ]
  ],
  "faqs": [
    {
      "q": "Is it safe to apply these settings directly on an active setup?",
      "a": "Yes—follow Section 4 by capturing a quick config backup or snapshot first and applying changes one parameter at a time."
    },
    {
      "q": "Are the benchmark tables identical across all five languages?",
      "a": "Yes, every table and technical note is embedded in our 5-language bundle for instant switching on desktop and mobile."
    }
  ]
}