diff options
Diffstat (limited to 'services/bin')
-rwxr-xr-x | services/bin/sync-host-to-services | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/services/bin/sync-host-to-services b/services/bin/sync-host-to-services new file mode 100755 index 00000000..ed795fb6 --- /dev/null +++ b/services/bin/sync-host-to-services @@ -0,0 +1,15 @@ +#!/bin/sh +green='\e[0;32m' +red='\e[0;31m' +nc='\e[0m' + +outdir=${1?please provide services-outdir} +find /etc/tinc/retiolum/hosts/ -type f | while read hostfile;do + host=$(basename "$hostfile") + if test -e "$outdir/$host";then + echo "${green}$host already exists$nc" + else + echo "${red}$host missing, adding${nc}" + cat ../services.txt | sed "s#{{hostname}}#$host#" > $outdir/$host + fi +done |