2
This commit is contained in:
parent
16aad23d12
commit
d9f57ef324
2
Makefile
2
Makefile
@ -1,3 +1,5 @@
|
|||||||
all:
|
all:
|
||||||
echo OK
|
echo OK
|
||||||
|
|
||||||
|
install:
|
||||||
|
cp -vf ping-host.sh /usr/local/bin/
|
||||||
|
|||||||
13
gen-and-install-service.sh
Normal file
13
gen-and-install-service.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
||||||
9
ping-host-target.service
Normal file
9
ping-host-target.service
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Ping a host service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/bin/bash /usr/local/bin/ping-host.sh ##TARGET##
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Loading…
x
Reference in New Issue
Block a user