22 lines
547 B
Bash
22 lines
547 B
Bash
#!/bin/sh
|
|
|
|
# This systemd generator creates dependency symlinks that make all OpenVPN
|
|
# tunnels listed in /etc/default/openvpn's AUTOSTART be started/stopped/reloaded
|
|
# when openvpn.service is started/stopped/reloaded.
|
|
|
|
set -eu
|
|
|
|
GENDIR="$1"
|
|
WANTDIR="$1/tellusagent.service.wants"
|
|
SERVICEFILE="/lib/systemd/system/tellusagent@.service"
|
|
CONFIG_DIR=/opt/TellusAgent/
|
|
|
|
mkdir -p "$WANTDIR"
|
|
|
|
for CONFIG in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`; do
|
|
NAME=${CONFIG%%.conf}
|
|
ln -s "$SERVICEFILE" "$WANTDIR/tellusagent@$NAME.service"
|
|
done
|
|
|
|
exit 0
|
|
|