I have a file where my script outputs IP and file paths. I want to process that file further where it could automatically ssh to that IP and take file stat of that path from respective IP
cat final-list
Node Name: 192.168.1.6 Out-ofSync-Filename: /home/user/nginx/Templates/file1
Node Name: 192.168.1.7 Out-ofSync-Filename: /home/user/nginx/createfile /home/user/nginx/Templates/file3
Node Name: 192.168.1.8 Out-ofSync-Filename: /home/user/nginx/nginx/Templates/file1 /home/user/nginx/nginx/Templates/file5 /home/user/nginx/nginx/Templates/file3 /home/user/nginx/nginx/Templates/file9 /home/user/nginx/nginx/file12 /home/user/nginx/Templates/file56
My script for parsing above file:
xargs -n1 < final-list | grep -v "Name:" | grep -v "Node" | grep -v "Out-ofSync-Filename:"
192.168.1.6
/home/user/nginx/Templates/file1
192.168.1.7
/home/user/nginx/createfile
/home/user/nginx/Templates/file3
192.168.1.8
/home/user/nginx/nginx/Templates/file1
/home/user/nginx/nginx/Templates/file5
/home/user/nginx/nginx/Templates/file3
/home/user/nginx/nginx/Templates/file9
/home/user/nginx/nginx/file12
/home/user/nginx/Templates/file56
It has IP and respective files(filepaths per IP may increase in future) for which I want to find out last modified time of that file by ssh into that server IP using respective Path.
rsyncin dry-run mode between some master repository of files and your various servers? This would tell you exactly what files are not up to date.