I have a script that reads a text file that has all the nodes listed in there:
node1
node2
node3
.
.
.
It creates a ".conf" file for each node in the /etc/icinga2/zones.d/master/hosts/new/ directory
Copies the content of the file name linux-template into each new conf file.
Everything worked as I expected, but I also get errors for each node:
Can anyone please help?
Thanks
This is my script:
#!/bin/bash
cd /etc/icinga2/zones.d/master/hosts/new
while read f; do
cp -v "$f" /etc/icinga2/zones.d/master/hosts/new/"$f.conf"
cp linux-template.conf "$f.conf"
chown icinga:icinga "$f.conf"
done < linux-list.txt
Once everything got copied, I get these errors below (for all the nodes, ie. node 1):
cp: cannot stat ‘node1’: No such file or directory
chown: cannot access ‘node1’: No such file or directory