Skip to content

service: don't trust a stale scheduler pid after reboot - #7

Draft
ash-iir wants to merge 1 commit into
mainfrom
fix-scheduler-boot
Draft

ash-iir wants to merge 1 commit into
mainfrom
fix-scheduler-boot

Conversation

@ash-iir

@ash-iir ash-iir commented Nov 19, 2026

Copy link
Copy Markdown
Owner

scheduler.loop.pid survives reboot. If its pid is reused by another process on the next boot, kill -0 succeeds and service.sh exits, so scheduled backups don't run until a later reboot.

The guard now reads /proc/<pid>/cmdline and only treats the loop as alive when it carries the pid-file path (the loop is started as sh -c '…' sh "$LOOPPID" …).

Testing

  • sh -n on service.sh.
  • Under mksh and busybox sh: a process started with the pid-file path in its argv matches; an unrelated process (sleep) doesn't.
  • Not tested on a rooted device.

The pid file survives reboot. When its pid was reused by another process,
kill -0 succeeded and the scheduler loop never started for that boot.
Match the loop's own command line, which carries the pid file path.

Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant