14 lines
280 B
Bash
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
|