forked from Catorpilor/linux_config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync_config.sh
More file actions
34 lines (29 loc) · 686 Bytes
/
sync_config.sh
File metadata and controls
34 lines (29 loc) · 686 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
26
27
28
29
30
31
32
33
34
function batch_sync_profile()
{
# tar the private setting.
tar czvf profile.tar.gz .bash_profile .bash_svn_completion .vimrc .ssh .dir_colors .xtail >/dev/null
sync_profile $1
rm profile.tar.gz
}
# sync a group of machines.
function group_sync_profile()
{
hostPrefix=$1
hostMin=$2
hostMax=$3
hostPostfix=$4
for((i=${hostMin}; i<=${hostMax}; i++)); do
local host=${hostPrefix}${i}${hostPostfix}
sync_profile $host
done
}
# sync one machine.
function sync_profile()
{
host=$1
echo $host
scp profile.tar.gz $host:~/
ssh $host tar zxvf ~/profile.tar.gz >/dev/null
ssh $host rm ~/profile.tar.gz
echo
}