-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathctl
executable file
·31 lines (22 loc) · 994 Bytes
/
ctl
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
#!/usr/local/bin/python3
import sys
import os
args = sys.argv
uwsgi = os.path.join(os.path.dirname(sys.executable), 'uwsgi')
if len(args) <= 1:
print('Usage: ctl [start|stop|reload|shell|migrate|update]')
elif args[1] == 'start':
os.system('nohup %s --ini uwsgi.ini --pidfile uwsgi.pid -d uwsgi.log &' % uwsgi)
elif args[1] == 'stop':
os.system('nohup %s --stop uwsgi.pid &' % uwsgi)
elif args[1] in ('reload', 'restart'):
os.system('nohup %s --reload uwsgi.pid &' % uwsgi)
elif args[1] == 'migrate':
os.system('%s manage.py makemigrations %s' % (sys.executable, ' '.join(args[2:])))
os.system('%s manage.py migrate %s' % (sys.executable, ' '.join(args[2:])))
elif args[1] == 'shell':
os.system('%s manage.py shell' % sys.executable)
elif args[1] == 'update':
os.system('%s manage.py update_stock_list' % sys.executable)
os.system('%s manage.py update_stock_top10' % sys.executable)
os.system('%s manage.py update_stock_basic' % sys.executable)