init scripts: rewrite S01logging
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest4 patches 0 repliesNew
- v44 patches 0 repliesSuperseded
- v3 posting 3/30 of 8 patches 0 repliesSuperseded
Earlier versions · 4
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v3 posting 2/3 | 0 of 8 patches | 0 replies | Superseded | |
| v3 posting 1/3 | 8 patches | 0 replies | Superseded | |
| v2 | 8 patches | 0 replies | Superseded | |
| v1 | 8 patches | 0 replies | Superseded |
Patches in v5 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | busybox: rewrite logging init scriptpackage/ package/ package/ +1 more | +121 | 1 reply | |
| 2/4 | rsyslog: rewrite init scriptpackage/ package/ package/ | +55 | 0 replies | |
| 3/4 | sysklogd: rewrite init scriptpackage/ package/ package/ +1 more | +131 | 0 replies | |
| 4/4 | syslog-ng: rewrite init scriptpackage/ package/ package/ | +64 | 0 replies |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by.
| Patch | Matt Weber |
|---|---|
| 1/4 | R-b |
| 2/4 | R-b |
| 3/4 | R-b |
| 4/4 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [Buildroot] [PATCH v5 0/4] init scripts: rewrite S01logging
Continuing our effort to improve daemon startup scripts, this series focuses on S01logging, which starts the logging daemon. Common features are:
- Indent with tabs, not spaces.
- Implement start, stop, restart and reload as functions.
- Use start-stop-daemon.
- Correctly detect and report start/stop/restart/reload errors.
- Support a configuration file at /etc/default.
- Use one init script per daemom. Name the script accordding to the daemon it starts (e.g. S01syslogd, S02klogd).
All files implement the following FSM:
+---------+
+-------stop--------+ +----(1s)----| stopped |
| | | | |
| | | +---------+
v | v ^
+---------+ +---------+ |
| | | |----restart---+
| STOPPED |----start--->| STARTED |
| | | |----reload----+
+---------+ +---------+ |
^ |
| |
+-----------------+* "stopped" is an intermediary state that transitions to STARTED after one second.
Attempts to do invalid transitions (e.g. start from STARTED state) will fail. That's why we don't pass -o (--oknodo) to start-stop-daemon. This changes the script behavior, in some cases, while in other cases just reports errors that were ignored previously.
The "restart" transition is implemented as "stop, sleep 1, start", so restarting from STOPPED state is possible, although an error message is shown because "stop" fails.
The "reload" transition semantics is "reload the configuration and keep running", when possible, otherwise it is the same as "restart" (in this series, sysklogd and syslog-ng support true "reload" operations).
The scripts were checked with shellcheck v0.5.0:
$ shellcheck package/*/S0*log*
Carlos Santos (4):
busybox: rewrite logging init script
rsyslog: rewrite init script
sysklogd: rewrite init script
syslog-ng: rewrite init script
package/busybox/S01logging | 40 --------------------- package/busybox/S01syslogd | 55 ++++++++++++++++++++++++++++ package/busybox/S02klogd | 55 ++++++++++++++++++++++++++++ package/busybox/busybox.mk | 19 +++++----- package/rsyslog/S01logging | 36 ------------------- package/rsyslog/S01rsyslogd | 53 +++++++++++++++++++++++++++ package/rsyslog/rsyslog.mk | 4 +-- package/sysklogd/S01logging | 25 ------------- package/sysklogd/S01syslogd | 62 ++++++++++++++++++++++++++++++++ package/sysklogd/S02klogd | 65 ++++++++++++++++++++++++++++++++++ package/sysklogd/sysklogd.mk | 6 ++-- package/syslog-ng/S01logging | 38 -------------------- package/syslog-ng/S01syslog-ng | 62 ++++++++++++++++++++++++++++++++ package/syslog-ng/syslog-ng.mk | 4 +-- 14 files changed, 371 insertions(+), 153 deletions(-) delete mode 100644 package/busybox/S01logging create mode 100644 package/busybox/S01syslogd create mode 100644 package/busybox/S02klogd delete mode 100644 package/rsyslog/S01logging create mode 100644 package/rsyslog/S01rsyslogd delete mode 100644 package/sysklogd/S01logging create mode 100644 package/sysklogd/S01syslogd create mode 100644 package/sysklogd/S02klogd delete mode 100644 package/syslog-ng/S01logging create mode 100644 package/syslog-ng/S01syslog-ng
Signature · 1 line
2.17.1