Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7389117
  • 博文数量: 1755
  • 博客积分: 18684
  • 博客等级: 上将
  • 技术积分: 16227
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-02 10:28
个人简介

啥也没写

文章分类

全部博文(1755)

文章存档

2024年(1)

2023年(44)

2022年(39)

2021年(46)

2020年(43)

2019年(27)

2018年(44)

2017年(50)

2016年(47)

2015年(15)

2014年(21)

2013年(43)

2012年(143)

2011年(228)

2010年(263)

2009年(384)

2008年(246)

2007年(30)

2006年(38)

2005年(2)

2004年(1)

分类: LINUX

2011-08-08 14:39:39

subversion中更新版本库,shell执行 cd /home/htdocs/app; svn update。现在实现一个小需求,请求一地址即执行上述命令来更新svn。有两个功能:
(1)程序监听地址
(2)客户端请求地址后执行命令cd /home/htdocs/app; svn update
另外一种使用python+daemon+socketserver见《http方式更新svn(socket)》 介绍。

下面用web.py框架实现的步骤:
1、框架安装
cd /usr/local/soft/
wget
tar zxvf web.py-0.33.tar.gz
cd web.py-0.33
python setup.py install
2、编写代码
vi /usr/local/webpy/subversion_web.py
#!/usr/bin/env python

# ...
import web,os
render = web.template.render('templates/')

urls = (
'/', 'index'
)
app = web.application(urls, globals())
class index:
def GET(self):
text = os.popen("cd /home/htdocs/app;svn update").read()
print text
return text

if __name__ == "__main__":
app.run()

3、程序永远后台执行
nohup /usr/local/webpy/subversion_web.py &
exit
4、测试更新

显示为:
C app/sitemap.xml
Updated to revision 32786.

参考文章:
webpy

linux程序永远后台运行
http://hi.baidu.com/addcn/blog/item/b4f7a98a1b086f739f2fb486.html
 
转:http://addcn.blogbus.com/logs/120814573.html
阅读(807) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~