Created
November 28, 2013 03:17
-
-
Save nikuuchi/7686794 to your computer and use it in GitHub Desktop.
envの使い方メモ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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