A backup unit restarts in a loop and then stops with `opskit-backup.service: Start request repeated too quickly.` and `Failed with result 'start-limit-hit'`.
IntermediateTroubleshootingTroubleshooting: cron and systemd timers
Answer
Likely causes → The unit has Restart=always (or on-failure) and the script fails fast, so systemd restarts it until it hits StartLimitBurst (default 5) within StartLimitIntervalSec (default 10s) and gives up. Often the unit was written as Type=simple with Restart=always, copied from a daemon template, for a job that should run once.
Diagnose →
systemctl show opskit-backup -p Type -p Restart -p NRestarts
journalctl -u opskit-backup -n 50 --no-pager # the actual error is above the restart lines
Fix → A scheduled job is Type=oneshot with no Restart=; the timer handles repetition and OnFailure= handles alerting:
[Service]
Type=oneshot
ExecStart=/opt/opskit/bin/backup.sh
OnFailure=opskit-alert@%n.service
Clear the state after fixing: systemctl reset-failed opskit-backup.service.
Prevent → Separate templates for daemons and jobs. If a job needs retries, implement backoff inside the script, or use Restart=on-failure with RestartSec=60 and a larger StartLimitIntervalSec.
More on Troubleshooting: cron and systemd timers
A new job in `/etc/cron.d/opskit` never runs. Syslog shows `cron[812]: (*system*opskit) ERROR (Missing newline before EOF, this crontab file will be ignored)`.BeginnerYou copied a line from `crontab -e` into `/etc/cron.d/backup`, and syslog shows `Error: bad username; while reading /etc/cron.d/backup`. Meanwhile a teammate's user crontab mails `/bin/sh: 1: root: not found` every night.BeginnerA script works when you run it, but the cron log email says `/opt/opskit/bin/backup.sh: line 22: aws: command not found`.BeginnerThis crontab line never produces a log file, and cron mails `/bin/sh: 1: Syntax error: end of file unexpected (expecting ")")`: `0 2 * * * /opt/backup.sh > /var/log/backup-$(date +%F).log 2>&1`IntermediateA cron job fails intermittently, but there are no emails and no logs. Syslog shows `(CRON) info (No MTA installed, discarding output)`.BeginnerA cron job that runs `docker exec -it db pg_dumpall` fails with `the input device is not a TTY`.Intermediate