Python 官方文档:入门教程 => 点击学习
最近公司在使用redmine来管理项目,为了便利维护,用python写了两个小程序,和大家分享一下启动和关闭:#!/usr/bin/env Python'''Use this script to change redmine status(
最近公司在使用redmine来管理项目,为了便利维护,用python写了两个小程序,和大家分享一下
启动和关闭:
#!/usr/bin/env Python
'''Use this script to change redmine status(start or stop)
write by liyufeng
data 2013 -5 -8'''
import subprocess
print('1.Stop , Please input "stop". \n2.Start , Plase input "start".\n3.Quit , Plase press space\n')
redminestatus = raw_input('Please input Status:')
try:
if redminestatus == 'stop':
subprocess.call("ps -ef |grep redmine | awk '{print $2}' |xargs kill -9",shell=True)
print '---------------------------'
print '-redmine-status is STOP!!!-'
print '---------------------------'
if redminestatus == 'start':
subprocess.call('ruby /usr/local/redmine/script/rails server WEBrick -e production -d',shell=True)
print '-------------------------'
print '-redmine-status is START-'
print '-------------------------'
except:
pass
修改密码:
#!/usr/bin/env python
'''Use this script to Change the admin passWord
write by liyufeng
data = 2013/5/8'''
import subprocess
data = raw_input('Please input password:')
subprocess.call("""RAILS_ENV=production script/rails runner 'user = User.find(:first, :conditions => {:admin => true}) ; user.password, user.password_confirmation = "%s"; user.save!'""",shell = True) % data
--结束END--
本文标题: python 编写管理redmine的相
本文链接: https://www.lsjlt.com/news/182929.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0