kiss-stj

My KISS Linux repo for software I use on my computers.
git clone https://git.stjo.hn/kiss-stj
Log | Files | Refs | README | LICENSE

commit 8f55d98cbe4cac89466164e45b7ad52e315e35f7
parent 8e52bb4b9b8388951e3bb1de785ad5b5f597fd66
Author: St John Karp <contact@stjo.hn>
Date:   Thu,  9 Jun 2022 06:39:35 -0400

svc: Add some new service scripts. Switch from pidof to pgrep.

pidof doesn't find background processes, so it just wasn't working
to detect whether or not the process was still running. pgrep
seems to do the trick.

Diffstat:
Mcore/svc/build | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/core/svc/build b/core/svc/build @@ -1,9 +1,11 @@ #!/usr/bin/env sh -# Fixes +# Switch all the paths from /bin to to /usr/bin. find . -type f -exec grep -l '/bin/svc\.d' {} \+ | xargs -I % sh -c "sed 's|/bin/svc\.d|/usr/bin/svc.d|g' % > _ && mv _ %" -sed 's/PPID \$BIN/PPID \$SERVICE/' svc.d/bare.sh > _ +# pgrep works better than pidof, especially when a daemon has +# forked to the background. Neither is POSIX, so I don't suppose it matters. +sed 's/pidof -o %PPID \$BIN/pgrep ^\$SERVICE\$/' svc.d/bare.sh > _ mv -f _ svc.d/bare.sh chmod +x svc.d/bare.sh @@ -12,7 +14,10 @@ install -m 755 -D bin/svc "$1/usr/bin/svc" cp -r svc.d "$1/usr/bin/svc.d" # Custom init scripts. +touch "$1/usr/bin/svc.d/avail/dhcpcd" install -D nldev "$1/usr/bin/svc.d/avail/nldev" +rm "$1/usr/bin/svc.d/avail/ntpd" "$1/usr/bin/svc.d/default/ntpd" +touch "$1/usr/bin/svc.d/avail/ntpd" touch "$1/usr/bin/svc.d/avail/pcscd" touch "$1/usr/bin/svc.d/avail/sdhcp" touch "$1/usr/bin/svc.d/avail/seatd"