flight
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 <localfile> <remotefile> <host_vars_dir>"
|
||||
echo "Usage: $0 <localfile> <remotefile>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
localfile="$1"
|
||||
remotefile="$2"
|
||||
host_vars_dir="$3"
|
||||
remotetmp="/var/tmp/4server"
|
||||
|
||||
|
||||
|
||||
while read -r host; do
|
||||
echo "Processing host: $host"
|
||||
@@ -32,7 +34,8 @@ while read -r host; do
|
||||
done
|
||||
|
||||
echo "Copying to $host:$remotefile"
|
||||
echo "$content" | ssh "$host" "cat > $remotefile"
|
||||
echo "$content" | ssh "$host" "cat > $remotetmp"
|
||||
rex doas mv $remotetmp $remotefile
|
||||
|
||||
done < "$hosts_file"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user