免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2373 | 回复: 3
打印 上一主题 下一主题

帮忙看个脚本,在线等,求救呀 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-07-07 16:14 |只看该作者 |倒序浏览
一个pubwin07.sh内容如下:运行时报:pubwin07.sh: line 99: syntax error: unexpected end of file
哪位高手知道办法!!!


[root@localhost ~]# vi pubwin07.sh
      1 #!/bin/bash
      2 #!/bin/awk -f
      3 #Mysql autobackup shell
      4 #
      5 #
      6 pubwin=`awk -F'[>.]' 'NR==3{print $2==6?"6":"7"}' /opt/Hintsoft/PubwinSe        rver/version/version_description.xml`
      7 if [ "$pubwin" = "6" ] then
      8 {
      9 #----------------set the mysql login parameters
     10 dbuser=netcafe
     11 dbpasswd=pubwin
     12 dbserver=localhost
     13 dbname=local
     14 tablename1=mem_localmemberbaseinfo
     15 tablename2=configitem
     16 tablename3=cur_usehistory
     17 tablename4=cur_user
     18 dbopt=--opt
     19 dbquick=--quick
     20 backupdir=/home/data/
     21 wbdb=8031
     22
     23 #-----------------set the FTP paramters , 0 no send to a ftp server,1 se        nd to a ftp server
     24 copytoftp=1
     25 ftpserver=192.168.1.247
     26 ftpuser=123456
     27 ftppasswd=123456
     28
     29 #----------------set the backpfile paramters
     30
     31 fileprefix=local
     32 dumpfilename=$backupdir$fileprefix`date +%F_%H%M%S`.sql
     33 newfile=$fileprefix-`date +%F_%H%M%S`.tar.gz
     34
     35 keepdays=10
     36 #------------------write the operater command to log file
     37 logfile=/var/log/_mysqlbackup.log
     38 logtmp=/var/log/_mybackup.tmp
     39
     40
     41 #===============================================
     42
     43 if [ ! -d $backupdir ]
     44 then
     45 echo "$backupdir is not exist, then make ..." >> $logfile
     46 mkdir -p $backupdir
     47 fi
     48
     49 echo "start====================================>">>$logfile
     50 echo "Beginning backup `date '+%F %T'`" >>$logfile
     51
     52 echo "Delete $keepdays days ago files ..." >>$logfile
     53
     54 find $backupdir -name $fileprefix* -mtime +$keepdays -fls $logtmp -exec         rm {} \;
     55 echo "Deleted Backup file is :">>$logfile
     56 cat $logtmp >>$logfile
     57 echo "Delete old file Success!" >>$logfile
     58
     59 if [ -f $backupdir$newfile ]
     60 then
     61 echo "$newfile backup exist, backup stop ..." >>$logfile
     62 else
     63 mysqldump  -u$dbuser -p$dbpasswd $dbname $tablename1 $tablename2 $tablen        ame3 $tablename4 >$dumpfilename
     64 fi
     65 tar czvf $backupdir$newfile $dumpfilename >>$logfile 2>&1
     66 echo "$backupdir$newfile Backup Success!" >>$logfile
     67 rm -fr $dumpfilename
     68
     69 if [ $copytoftp = 1 ]; then
     70 if [ -z $ftpserver ];then
     71 echo "Ftp Server not set,Copy to Ftp Failed ..." >>$logfile
     72 exit 1
     73 elif [ -z $ftpuser ];then
     74 echo "Ftp user not set, Copy to Ftp Failed ..." >>$logfile
     75 exit 2
     76 elif [ -z $ftppasswd ]; then
     77 echo "Ftp password not set, Copy to Ftp Failed ..." >>$logfile
     78 exit 3
     79 else
     80 echo "Start copy to Ftp server ...." >> $logfile
     81
     82 ftp -i -n <<end_ftp
     83 open $ftpserver
     84 user $ftpuser $ftppasswd
     85 binary
     86 cd $wbdb
     87 lcd $backupdir
     88 hash
     89 prompt
     90 put $newfile
     91 close
     92 bye
     93 end_ftp
     94
     95 fi
     96 fi
     97 echo "End=======================================">>$logfile
     98 # the end of the auto backup script
~
~
"pubwin07.sh" 98L, 2388C written
[root@localhost ~]# sh pubwin07.sh
pubwin07.sh: line 99: syntax error: unexpected end of file
[root@localhost ~]#

论坛徽章:
0
2 [报告]
发表于 2011-07-07 16:20 |只看该作者
问一下楼主 与你第八行的{ 对应的 } 结束符 在哪里?

论坛徽章:
0
3 [报告]
发表于 2011-07-07 16:21 |只看该作者
本帖最后由 caoshaocong 于 2011-07-07 16:29 编辑

还有第七行 then 前面加个; 号吧!
按照提示来说 貌似是少结束符了  你看看你的fi是不是少了?

论坛徽章:
0
4 [报告]
发表于 2011-07-07 16:21 |只看该作者
if  ..fi匹配吗
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP