Skip to content

Instantly share code, notes, and snippets.

@cedar101
Created February 14, 2012 03:50
Show Gist options
  • Save cedar101/1823348 to your computer and use it in GitHub Desktop.
Save cedar101/1823348 to your computer and use it in GitHub Desktop.
Fabric Example
#! /usr/bin/env python
# encoding: utf-8
from fabric.api import env, hosts, roles, run, execute, cd
env.roledefs = {
'RelMem': 'relmem1 relmem2'.split(),
'HRoadBroker': 'h-roadsbroker1 h-roadsbroker2'.split(),
'HRoad': 'h-roads1 h-roads2 h-roads3 h-roads4 h-roads5 h-roads6'.split()
}
@role('RelMem')
def relmems():
with cd('/usr/bin/relmem'):
run('./RDaemonServer -d')
run('./RelMemServer -d')
@hosts('relmem2')
def rdummy():
with cd('/usr/bin/rdummy'):
run('./RDummyServer -d')
@role('HRoadBroker')
def hroadbroker():
with cd('/usr/bin/hroadbroker'):
run('./HRoadBroker -d')
@role('HRoad')
def hroad():
with cd('/usr/bin/hroad'):
run('./GraphServer -d')
def start_relmem_hroad():
'''
실행 방법
$ fab start_relmem_hroad
'''
execute(relmems) # 1, 2, 4, 5
execute(rdummy) # 3
execute(hroadbroker) # 6, 7
execute(hroad) # 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment