Systemd service that restarts too eagerly

Back to list2026-08-19
You

My service restarts in a loop and floods the journal.

ChatGPT

Add a backoff. RestartSec=5 plus StartLimitIntervalSec=120 and StartLimitBurst=5 turns a hot loop into five attempts and then a stop, which is what you want: a service that cannot start should stay down loudly rather than churn quietly.

Tool steps: 3 (reasoning summary, call to python, execution output)
reasoning summary
Checked the query plan, then compared index options.
call to python
rows = run_sql("EXPLAIN (ANALYZE) SELECT ...")
print(rows[:3])
execution output
Seq Scan on events  (cost=0.00..812431.00 rows=41203122 width=16)
  Rows Removed by Filter: 38996878
Planning Time: 0.214 ms
Execution Time: 11842.663 ms
You

journalctl output is overwhelming during an incident.

ChatGPT

Narrow before you read: journalctl -u myservice --since "10 min ago" -p warning gives the unit, the window and the severity in one line. -o cat strips the metadata once you know where you are.

You

Two users need to write to the same folder without stepping on each other.

ChatGPT

A shared group plus the setgid bit: chgrp team dir && chmod 2775 dir. New files inherit the group, which is the part plain chmod 775 misses and the reason it stops working on the second day.