1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#!/bin/sh
# This systemd generator creates dependency symlinks that make all weborf
# instances with start=auto configuration file be started/stopped/reloaded
# when weborf.service is started/stopped/reloaded.
set -eu
gendir="$1"
wantdir="$1/weborf.service.wants"
instance="/usr/lib/systemd/system/weborf@.service"
mkdir -p "$wantdir"
for conf in /etc/weborf.d/*.conf; do
# abort loop if glob was not expanded (but accept dead symlinks)
if ! test -e "$conf" && ! test -L "$conf"; then continue; fi
if ! grep "^start=auto$" < $conf > /dev/null; then
continue
fi
ln -s "$instance" "$wantdir/weborf@`basename $conf`.service"
done
exit 0
|