-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevwp.sh
More file actions
executable file
·83 lines (76 loc) · 1.31 KB
/
devwp.sh
File metadata and controls
executable file
·83 lines (76 loc) · 1.31 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#/bin/sh
MODE="$1"
echo "$MODE"
exist_container() {
if [ $(docker-compose ps -q wordpress) ]; then
return 1
else
return 0
fi
}
cmd_init() {
echo Inital containers...
docker-compose up -d && docker-compose exec wordpress ln -s /usr/src/devtheme /var/www/html/wp-content/themes/devtheme
}
cmd_start() {
echo Start containers...
docker-compose start
}
cmd_stop() {
echo Stop containers...
docker-compose stop
}
cmd_rm() {
echo Remove containers...
docker-compose rm -f
}
if [ "$MODE" = "init" ]; then
exist_container
if [ "$?" = "0" ]; then
cmd_init
else
echo Already exist container.
fi
exit 0
elif [ "$MODE" = "start" ]; then
exist_container
if [ "$?" = "0" ]; then
cmd_init
else
cmd_start
fi
exit 0
elif [ "$MODE" = "stop" ]; then
exist_container
if [ "$?" = "0" ]; then
echo "Does not exist containers"
else
cmd_stop
fi
exit 0
elif [ "$MODE" = "restart" ]; then
exist_container
if [ "$?" = "0" ]; then
cmd_start
else
cmd_stop
cmd_start
fi
exit 0
elif [ "$MODE" = "reset" ]; then
cmd_stop
cmd_rm
cmd_init
exit $?
elif [ "$MODE" = "remove" ]; then
exist_container
if [ "$?" = "0" ]; then
cmd_rm
else
cmd_stop
cmd_rm
fi
exit $?
else
echo Available options [init, start, stop, restart, reset, remove]
fi