Skip to content

Instantly share code, notes, and snippets.

@nikuuchi
Created November 28, 2013 03:17
Show Gist options
  • Select an option

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

Select an option

Save nikuuchi/7686794 to your computer and use it in GitHub Desktop.
envの使い方メモ
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 = '******'
env.password = '******'
@task
def app():
env.hosts = ['app1', 'app2']
@task
def web():
env.hosts = ['web']
@task
def test():
run('echo hoge')
@task
def pull():
with cd('~/'):
run('git fetch origin')
run('git merge origin/master')
@task
def zip():
with cd('~/'):
today = date.today()
sudo('zip '+ today.isoformat()+ '.zip /path/to/*.log')
@task
def install_zip():
sudo('apt-get install zip -y')
@task
def count_log():
run('ls -1 /path/to/*.log | wc -l')
@task
def cat_log():
run('cat /path/to/*.log')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment