常用的几个shell脚本_3_恢复工程
2007-11-30 18:20
766 查看
#!/bin/bash
#if is root , you must use root run this shell
if [ "`whoami`" != "root" ] ; then
echo "*************************************************"
echo "You must run $0 as root!!!"
echo "You can use commond 'su',change user to root..."
echo "*************************************************"
exit 1
fi
#read filename
echo "input filename:"
read filename
echo $filename
#file if == null
if ! test -f $filename
then
echo "*************************************************"
echo "The filename is false"
echo "*************************************************"
exit 1
fi
#get system time
c_time=$(date +%Y_%m_%d_%H_%M_%S)
echo "stop server ..."
/app/java_project/tomcat5.0/bin/shutdown.sh
echo "beifen old file ..."
mv /app/java_project/mis/mainone /app/java_project/mis/updata/mainone_back$c_time
echo "new file ..."
mv /app/java_project/mis/updata/$filename /app/java_project/mis/mainone
echo "start sever ..."
/app/java_project/tomcat5.0/bin/startup.sh
echo "bei fen new file ... "
cp -R /app/java_project/mis/mainone /app/java_project/mis/updata/mis_beifen
chmod -R 777 /app/java_project/mis/updata/mis_beifen
# quit root
exit
#if is root , you must use root run this shell
if [ "`whoami`" != "root" ] ; then
echo "*************************************************"
echo "You must run $0 as root!!!"
echo "You can use commond 'su',change user to root..."
echo "*************************************************"
exit 1
fi
#read filename
echo "input filename:"
read filename
echo $filename
#file if == null
if ! test -f $filename
then
echo "*************************************************"
echo "The filename is false"
echo "*************************************************"
exit 1
fi
#get system time
c_time=$(date +%Y_%m_%d_%H_%M_%S)
echo "stop server ..."
/app/java_project/tomcat5.0/bin/shutdown.sh
echo "beifen old file ..."
mv /app/java_project/mis/mainone /app/java_project/mis/updata/mainone_back$c_time
echo "new file ..."
mv /app/java_project/mis/updata/$filename /app/java_project/mis/mainone
echo "start sever ..."
/app/java_project/tomcat5.0/bin/startup.sh
echo "bei fen new file ... "
cp -R /app/java_project/mis/mainone /app/java_project/mis/updata/mis_beifen
chmod -R 777 /app/java_project/mis/updata/mis_beifen
# quit root
exit
相关文章推荐
- 常用的几个shell脚本_1_更新工程
- 常用的几个shell脚本_2_查看日志
- 几个常用shell脚本命令
- 常用的几个shell脚本_4_更新jsp
- *Linux Shell 高级编程技巧4----几个常用的shell脚本例子
- shell脚本常用的几个命令
- 几个常用的Linux系统性能监控shell脚本
- 几个常用的shell脚本
- 几个常用的shell脚本
- shell脚本中的几个括号总结(小括号/大括号/花括号)
- Linux常用的主机监控shell脚本
- Linux常用shell脚本
- 几个常用的Linux操作系统监控脚本
- 自己常用的一些shell脚本分享
- 常用的主机监控shell脚本
- 常用shell脚本操作
- 两年前放在百度文库的几个初学shell脚本时写的几个简单例子
- 常用的shell脚本
- Python编写shell脚本中常用的文件介绍
- 几个简单常用的脚本