- 论坛徽章:
- 7
|
Becouse of so many repeated works, I must attemp to manage them by shell scripts. The basic architecture is management client and productation server.
At first, build up the trusted relationship between admin staton and servers.
It is recommended using ssh instead of rsh due to security issue.
Secondly, we can put some strong scripts into one specified directory in the client workstartion. I show one copy instance as the following:
#!/bin/sh
# Author: nimysun
### I suggest we define server ip and server hostname in the hosts.server
### then we can run shell in every servers, therefore we must ensure if ###
### the hosts.server is correct
if [ $# -eq 1 ]; then
continue
else
exit 1
fi
if [ -d $1] || [ -f $1 ]; then
continue
else
exit 2
fi
for i in `nawk '{print $2}' hosts.server`
do
rsync -avz --delete -e ssh $1 $i:$1
done
to strongthen shell function, we can add some facility to produce log file to validate the results.
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/43/showart_261037.html |
|