-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbin.sh
More file actions
25 lines (20 loc) · 712 Bytes
/
bin.sh
File metadata and controls
25 lines (20 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
# exit if required variables aren't set
set -o nounset
# only run on host Desktop-Snow
if [ "$(hostname)" != "Desktop-Snow" ]; then
echo "This script should only be run on Desktop-Snow."
exit 1
fi
# if no arguments are provided, output syntax and exit
if [ "$#" -ne 0 ]; then
echo -e "\nUsage: $0\n"
exit 1
fi
# list of hosts to copy bin directory to
declare -a BINHOSTS="(atom lasciel nuc storage wall)"
# iterate through list of hosts, rsyncing bin directory and creating if non-existent
for HOST in "${BINHOSTS[@]}"; do
rsync -a --timeout=5 --rsync-path='mkdir /home/sinc/bin 2>/dev/null; rsync' /home/sinc/bin/ "${HOST}":/home/sinc/bin
echo "Copied to host ${HOST}."
done