1,xcall.sh
#!/bin/bash
pcount=$#
if((pcount==0));then
echo no args;
exit;
fi
echo -------------************----------
hosts=(master slave1 slave2)
for host in
h
o
s
t
s
[
@
]
;
d
o
e
c
h
o
−
−
−
−
−
−
−
−
−
−
{hosts[@]}; do echo ----------
hosts[@];doecho−−−−−−−−−−host---------
ssh $host $@
done
===============
2,xsync.sh
#!/bin/sh
pcount=$#
if((pcount==0)); then
echo no args…;
exit;
fi
p1=$1
fname=basename $p1
echo fname=$fname
pdir=cd -P $(dirname $p1); pwd
echo pdir=$pdir
user=whoami
for((host=1; host<=2; host++)); do
echo
p
d
i
r
/
pdir/
pdir/fname
u
s
e
r
@
s
l
a
v
e
user@slave
user@slavehost:
p
d
i
r
e
c
h
o
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
s
l
a
v
e
pdir echo ==================slave
pdirecho==================slavehost==================
rsync -rvl
p
d
i
r
/
pdir/
pdir/fname
u
s
e
r
@
s
l
a
v
e
user@slave
user@slavehost:$pdir
done