This repository has been archived by the owner on Oct 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
darklist.sh
122 lines (109 loc) · 2.94 KB
/
darklist.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
# =============================================================================
#
# Darklist
# https://github.com/h0lysp4nk/Darklist
#
# =============================================================================
echo ' ____ __ ___ __ '
echo ' / __ \____ ______/ /__/ (_)____/ /_ '
echo ' / / / / __ `/ ___/ //_/ / / ___/ __/ '
echo ' / /_/ / /_/ / / / ,< / / (__ ) /_ '
echo '/_____/\__,_/_/ /_/|_/_/_/____/\__/ '
echo ' '
echo ''
echo '==================================================='
echo
echo
# Set dir
script_dir=`dirname $0`
cd $script_dir/dldata
# Handle cli input
case $1 in
"ps")
# Get the status of Darklist
docker-compose ps
# Check to see if that command executed successfully
if [ $? -eq 0 ]; then
# Success
echo "[!] Successfully received the status of Darklist!"
exit 0
else
# Failure
echo "[!] Couldn't get the status of Darklist!"
exit 1
fi;;
"restart")
# Restart Darklist
docker-compose stop && docker-compose up -d
# Check to see if that command executed successfully
if [ $? -eq 0 ]; then
# Success
echo "[!] Darklist restarted successfully!"
exit 0
else
# Failure
echo "[!] Darklist failed to restart!"
exit 1
fi;;
"stop")
# Stop Darklist
docker-compose stop
# Check to see if that command executed successfully
if [ $? -eq 0 ]; then
# Success
echo "[!] Darklist stopped successfully!"
exit 0
else
# Failure
echo "[!] Darklist failed to stop!"
exit 1
fi;;
"start")
# Start Darklist
docker-compose up -d
# Check to see if that command executed successfully
if [ $? -eq 0 ]; then
# Success
echo "[!] Darklist started successfully!"
exit 0
else
# Failure
echo "[!] Darklist failed to start!"
exit 1
fi;;
"uninstall")
# Uninstall Darklist
docker-compose down
# Check to see if that command executed successfully
if [ $? -eq 0 ]; then
echo "[!] Darklist containers were successfully destroyed!"
echo "[!] To finish the removal of Darklist type: 'docker system prune' ALTHOUGH be careful as this will remove any dangling containers/images! Ensure that before running this command that all you're docker containres are online!"
else
echo "[!] Darklist containers couldn't be destroyed!"
exit 1
fi;;
"install")
# Install Darklist
docker network create darklist
# Check to see if that command executed successfully
if [ $? -eq 0 ]; then
# Success
echo "[!] Darklist docker network created!"
else
# Failure
echo "[!] Darklist docker network couldn't be created! Does it already exist?"
fi
docker-compose up -d --build
# Check to see if that command executed successfully
if [ $? -eq 0 ]; then
# Success
echo "[!] Darklist was successfully started!"
else
# Failure
echo "[!] Darklist couldn't be installed!"
exit 1
fi;;
*)
echo "[!] Usage: ./darklist.sh <start|stop|restart|ps|install>";;
esac