Skip to main content
100%

Gist 4521887

✓ Published0🌍 Public
Aallyraza
Last edited Jan 13, 2013
Created on Jan 13, 2013

This example shows a shell-command supervisor that forks a child process, monitors its exit status, and restarts it on failure. The code uses POSIX APIs including `fork()`, `execl()`, `waitpid()`, and `signal()` to launch and track the command, while logging each step. It writes a pidfile, tracks restart timing with `timestamp()` and `ms_since_last_restart()`, and bails after exceeding `max_attempts` within a time window, executing an error command if configured. The visualization is a plain C source file, not a graphical chart, demonstrating process lifecycle logic.

AI-generated description

Similar vizzes