#!/usr/bin/env python
'''Python3 脚本开启和停止redmine
create by Jack
date 2013-5-15'''
import subprocess
print('1.Stop , Please input "stop". \n2.Start , Plase input "start".\n3.Quit , Plase press space\n')
redminestatus = input('Please input Status:')
try:
if redminestatus == 'stop':
subprocess.call("ps aux |grep ruby | awk '/server/{print $2}' |xargs kill -9", shell=True)
print('-redmine-status is STOP!!!-')
if redminestatus == 'start':
subprocess.call('ruby /var/www/redmine1.2/script/server webrick -p 8000 -e production -d', shell=True)
print('-redmine-status is START-')
except:
pass