随笔-69  评论-0  文章-5  trackbacks-0
ant

<?xml version="1.0"?>
<project name="PGAgent" basedir="." default="default">
    
    
<target name="default" depends="deploy" description="代理商平台构建" />
    
    
<property name="build.path" value="build" />
    
    
<tstamp>
        
<format property="date.MMdd" pattern="MMdd"/>
    
</tstamp>
    
    
<filterset id="filter.test">
        
<filter token="dataSource.url" value="jdbc:oracle:thin:@1.2.3.4:1521:p5dbb1"/>
        
<filter token="dataSource.username" value="gagent"/>
        
<filter token="dataSource.password" value="gagent"/>
        
<filter token="log4j.path" value="/home/xuzhijin/logs/pgagent/pgagent.log"/>
    
</filterset>
    
    
<filterset id="filter.deploy">
        
<filter token="dataSource.url" value="null"/>
        
<filter token="dataSource.username" value="null"/>
        
<filter token="dataSource.password" value="null"/>
        
<filter token="log4j.path" value="null"/>
    
</filterset>    

    
<target name="deploy" depends="test_tidy,deploy_tidy">
        
<antcall target="clean_before" />
           
<zip destfile="${build.path}/${ant.project.name}_test_${date.MMdd}.zip" basedir="${build.path}/test" />
           
<zip destfile="${build.path}/${ant.project.name}_deploy_${date.MMdd}.zip" basedir="${build.path}/deploy" />
        
<antcall target="clean_after" />
    
</target>
    
    
<target name="deploy_tidy">
        
<copy todir="${build.path}/deploy/${ant.project.name}/">
            
<fileset dir="${basedir}/WebRoot/">
                
<exclude name="**/.svn"/>
                
<exclude name="**/.svn/*.*"/>
            
</fileset>
        
</copy>
        
<copy todir="${build.path}/deploy/${ant.project.name}/WEB-INF/classes" overwrite="true" >
            
<fileset dir="${basedir}/buildFilter/">
                
<include name="*.properties"/>
            
</fileset>                
            
<filterset refid="filter.deploy" />
        
</copy>
    
</target>
    
    
<target name="test_tidy">
        
<copy todir="${build.path}/test/${ant.project.name}/">
            
<fileset dir="${basedir}/WebRoot/">
                
<exclude name="**/.svn"/>
                
<exclude name="**/.svn/*.*"/>
            
</fileset>
        
</copy>
        
<copy todir="${build.path}/test/${ant.project.name}/WEB-INF/classes/" overwrite="true" >
            
<fileset dir="${basedir}/buildFilter/">
                
<include name="*.properties"/>
            
</fileset>            
            
<filterset refid="filter.test" />
        
</copy>
    
</target>    
    
    
<target name="clean_after">
        
<delete dir="${build.path}/test" />
        
<delete dir="${build.path}/deploy" />
    
</target>
    
    
<target name="clean_before">
        
<delete file="${build.path}/${ant.project.name}_test_${date.MMdd}.zip" />
        
<delete file="${build.path}/${ant.project.name}_deploy_${date.MMdd}.zip" />
    
</target>

</project>



bash:
#!/bin/bash
file_prefix=PGAgent_test
dest_dir
=/usr/local/ciecc/webapps/
today
=`date +%m%d`
 
rm 
-rf $dest_dir${file_prefix%_*}
unzip 
-$dest_dir $file_prefix'_'$today.zip
tail 
-/home/xuzhijin/logs/pgagent/pgagent.log

posted on 2008-02-22 20:28 liunix 阅读(151) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: