-
Notifications
You must be signed in to change notification settings - Fork 0
/
vnet-all.sh
executable file
·61 lines (53 loc) · 922 Bytes
/
vnet-all.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
MODE=$1
RUBY_PATH=/opt/axsh/wakame-vnet/ruby/bin
export PATH=$RUBY_PATH:$PATH
function start() {
initctl start vnet-vnmgr
initctl start vnet-webapi
initctl start vnet-vna
}
function stop() {
initctl stop vnet-vnmgr
initctl stop vnet-webapi
initctl stop vnet-vna
}
function dbclear() {
mysql -uroot -e 'DROP DATABASE vnet;'
mysql -uroot -e 'CREATE DATABASE vnet;'
cd /opt/axsh/wakame-vnet/vnet
bundle exec rake db:init
mysql -uroot -e 'SHOW TABLES;' vnet
}
function logclear() {
rm /var/log/wakame-vnet/*
}
function status() {
initctl status vnet-vnmgr
initctl status vnet-webapi
initctl status vnet-vna
}
case "$MODE" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
resetdb)
stop
dbclear
logclear
start
;;
*)
echo "Usage: $0 (start|stop|status|restart|resetdb)"
;;
esac