#!/bin/bash
#
#update scripts
Nowtime=$(date +%Y-%m-%d:%H:%M:%S)
rmyzzt_svn=/usr/oldyzztserver
portlist="`egrep -v "^#|^$" /usr/serverlist | awk '{print $3}' | tr "\n" " "`"
sum=0
show_usage()
{
echo " 8000 update"
echo " all update"
}
update_oldyzztserver()
{
PATH_RMDIR=/$rmyzzt_svn/$1
cp -p $PATH_RMDIR/resources/{jdbc.properties,server.properties,fcmserver.properties} $PATH_RMDIR/
for update in `ls $PATH_RMDIR/release_s1`
do
sum=$((sum+1))
echo $update
rm -rf $PATH_RMDIR/$update
done
cp -pa release_s1/* $PATH_RMDIR
rm -rf $PATH_RMDIR/lib/classes.jar
cp -a $PATH_RMDIR/dist/classes.jar $PATH_RMDIR/lib
mv $PATH_RMDIR/{jdbc.properties,server.properties,fcmserver.properties} $PATH_RMDIR/resources/
}
case "$1" in
8[0-9][0-9][0-9]|all)
;;
*)
show_usage
echo "The first parameter {8000|8001|8002|8003|...|all}"
exit 1
;;
esac
case "$2" in
update)
;;
*)
show_usage
echo "The parameter update"
echo 1
;;
esac
_OPT=$1
if [ "$_OPT" != "all" ];
then
cd $rmyzzt_svn/$_OPT
case "$2" in
update)
update_oldyzztserver $_OPT
sleep 2
;;
*)
echo "Usage: $0 "
;;
esac
elif [ "$_OPT" = "all" ];
then
for port in $portlist
do
cd $rmyzzt_svn/$port
case "$2" in
update)
update_oldyzztserver $port
sleep 2
;;
*)
echo "Usage: $0 "
;;
esac
done
else
show_usage
exit 1
fi