Skip to content

Instantly share code, notes, and snippets.

@nikuuchi
Created November 19, 2013 07:51
Show Gist options
  • Select an option

  • Save nikuuchi/7541788 to your computer and use it in GitHub Desktop.

Select an option

Save nikuuchi/7541788 to your computer and use it in GitHub Desktop.
簡単なfabricのutil
from fabric.api import local, env, run, sudo, cd
from fabric.decorators import task
import time
from datetime import date
env.use_ssh_config = True
env.user = 'FIXME'
env.password = 'FIXME'
@task
def app():
env.hosts = ['host1']
@task
def web():
env.hosts = ['host2']
@task
def test():
run('echo hoge')
@task
def pull():
with cd('~/app'):
run('git fetch origin')
run('git merge origin/master')
@task
def zip():
with cd('~'):
today = date.today()
sudo('zip '+ today.isoformat()+ '.zip /tmp/*.c /tmp/*.js')
@task
def install_zip():
sudo('apt-get install zip -y')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment