-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
40 lines (29 loc) · 877 Bytes
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
import re
from fabric.api import sudo, run, cd, local, put, get, warn
def commit(message='', push='n'):
"""
Usage:
$ fab commit:message='commit message and escaping comma\, this way',push=n
"""
local("git add . && git commit -m '{}'".format(message))
if push == 'y':
local("git push")
def deploy():
stop()
with cd('/var/www/exotic-rpi'):
run('git checkout .')
run('git pull')
start()
def start():
with cd('/var/www/exotic-rpi'):
sudo('bash scripts/daemon.sh start')
sudo('bash scripts/daemon.sh status')
def stop():
with cd('/var/www/exotic-rpi'):
output = sudo('bash scripts/daemon.sh status', warn_only=True)
if re.search(r'.+is running\.', output):
sudo('bash scripts/daemon.sh stop')
def restart():
stop()
start()