添加留言
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]
               

 
rlogin Email
2011-10-14 16:40
张工,我按照书上的敲了一下你在《互联网运营智慧》一书中的Mysql自动定时备份并删除5天前的备份数据的脚本,但是执行的时候有些问题,麻烦您给看下是否我的脚本中有错误的地方,服务器环境为Readhat5.4—64位:
(1)代码如下:
#!/bin/bash
BackupPath=/data/databk
Mysql_bk_dir=$BackupPath/mysql_bk_dir
LogFile=$BackupPath/backuplog
Passwd=123456
for i in $(mysql -p$passwd -e \"show databasesG\" |grep Database |awk\'
      {print $2}\')
do
####################################################################
#                    define mysql variables
####################################################################
NewFile=\"$Mysql_bk_dir\"/$i$(date +%Y%m%d).tgz
DumpFile=\"$Mysql_bk_dir\"/$i$(date +%Y%m%d).sql
OldFile=\"$Mysql_bk_dir\"/$i$(date  +%Y%m%d --date=\'5 days ago\').tgz
####################################################################
#                     mysql backup proccess
####################################################################
echo \"-------------------------------------------------\" >> $LogFile
echo $(date +\"%y-%m-%d %H%M%S\") >> $LogFile
echo \"-------------------------------------------------\" >> $LogFile
#Delete Old File
if [ -f $OldFile ]
then
rm -f $OldFile >> $LogFile 2>&1
  echo \"[$OldFile]\"Delete Old File Success!\" >> $LogFile
else
  echo \"[$OldFile]\"No Old Buckup File!\" >> $LogFile
fi
if[-f $NewFile]
then
echo \"[$OldFile]\"The Buckup File is exists,Can\'t Backup!\" >> $LogFile
else
cd $Mysql_bk_dir
/usr/local/mysql/bin/mysqldump --opt $i -p$passwd > $DumpFile
tar czf $NewFile $i$(date +%Y%m%d).sql >> $LogFile 2>&1
echo \"[$NewFile]\"Backup Success!\" >> $LogFile
rm -rf $DumpFile
fi
sleep 20
done
mail -s \"mysql backup is success!\"rlogin@foxmail.com </data/databk/backuplog

运行后错误提示如下:
[root@localhost tomcat2]# cd /usr/local/bin/
[root@localhost bin]# chmod +x mysql_backup.sh
[root@localhost bin]# sh mysql_backup.sh
\'ysql_backup.sh: line 8: syntax error near unexpected token `do
\'ysql_backup.sh: line 8: `do
[root@localhost bin]#

(2)将上边代码中的:
for i in $(mysql -p$passwd -e \"show databasesG\" |grep Database |awk\'
      {print $2}\')
do
改变成:
for i in $(mysql -p$passwd -e \"show databasesG\" |grep Database |awk\' {print $2}\')
do
后运行提示如下:
\'ysql_backup.sh: line 7: syntax error near unexpected token `do
\'ysql_backup.sh: line 7: `do

(3)将代码改变为:
for i in $(mysql -p$passwd -e \"show databasesG\" |grep Database |awk\' {print $2}\')do
运行后,提示如下:
mysql_backup.sh: line 10: syntax error near unexpected token `NewFile=\"$Mysql_bk\'dir\"/$i$(date +%Y%m%d).tgz
\'ysql_backup.sh: line 10: `NewFile=\"$Mysql_bk_dir\"/$i$(date +%Y%m%d).tgz

求张工指教,我QQ:359058503,Email:rlogin@foxmail.com
云客 Email
2011-10-14 16:18
apche +mysql 不是说是PHP平台的绝配吗。不知道现在的这个NG到底怎样。能具体说明下吗。期待
张 宴
2011-10-14 13:08
初步定在十月二十八号,谢谢大家
好朋友
2011-10-14 11:50
怎么还没有发布啊??发个抢先版呗。好着急啊。
闰土 Email Homepage
2011-10-12 17:31
APMServ6什么时候出啊 ,我好期待
中间件 Email Homepage
2011-10-12 16:31
新手想学习服务器的相关知识,先从张老师的博客起步,哈。
chenjihang Email
2011-10-8 11:13
你好,张老师,今天刚注册,想咨询个问题。刚接触APMServ5.2.6,我的网站根目录下访问没有问题,但我要在本机设置多个虚拟目录,同时可以测试多个网站。这个虚拟目录如何设置,我搞了好久都没有搞定!我的QQ号是89076648,方便请为我解答一下,谢谢!
Bin Homepage
2011-10-8 04:25
Win版适合做服务器吗
王海
2011-10-6 01:30
张老师 您好,想跟你谈一下关于搜索引擎相关的技术与业务,相信会有很不错的收益!

联系QQ 854854   麻烦您加我QQ沟通一下 ,谢谢了!
suifeng
2011-10-4 12:58
张老师,您好!
APMServ5.2.6在Windows server 2003运行一段时间后出现这个问题,是什么原因,谢谢~
Zend Optimizer not installed
This file was encoded by the Zend Encoder / Zend SafeGuard Suite

In order to run it, please install the freely available Zend Optimizer, version 2.1.0 or later.

What is the Zend Optimizer?
The Zend Optimizer is one of the most popular PHP plugins for performance-improvement, and has been freely available since the early days of PHP 4. It improves performance by taking PHP's intermediate code through multiple Optimization Passes, which replace inefficient code patterns with efficient code blocks. The replacement code blocks perform exactly the same operations as the original code, only faster.

In addition to performance-improvement, the Zend Optimizer also enables PHP to transparently load files encoded by the Zend Encoder or Zend SafeGuard Suite.

The Zend Optimizer is a freely-available product from Zend Technologies. Zend Technologies is the company that develops the scripting engine of PHP, also known as the Zend Engine.
分页: 2463/2613 第一页 上页 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 下页 最后页