ping-out/gen-and-install-service.sh
Eliezer Croitoru d9f57ef324 2
2024-11-19 18:48:46 +02:00

14 lines
280 B
Bash

#!/usr/bin/env bash
HOST="$1"
set -x
echo "${HOST}" | egrep "^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$"
if [ "$?" -eq "0" ]
then
cat ping-host-target.service | sed -e "s@##TARGET##@${HOST}@g" > "/etc/systemd/system/ping-host-${HOST}.service"
systemctl daemon-reload
fi
set +x