-
Notifications
You must be signed in to change notification settings - Fork 0
/
zombieland
executable file
·54 lines (51 loc) · 949 Bytes
/
zombieland
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
#! /bin/sh
### BEGIN INIT INFO
# Provides: zombieland
# Required-Start: docker
# Required-Stop: docker
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Brains!!
# Description: Enable service provided by zombieland.
### END INIT INFO
#
# Author: Leandro Duque Mussio <[email protected]>
#
# Function that starts the daemon/service
#
do_start()
{
start docker
count=$(docker ps -a | grep " zombieland " | wc -l)
if [ "$count" -eq 0 ]; then
docker run --name zombieland -d lmussio/cc4211
else
docker start zombieland
fi
}
#
# Function that stops the daemon/service
#
do_stop()
{
docker stop zombieland
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
status)
docker ps -a --filter="name=zombieland" | grep "NAMES\| zombieland "
;;
restart|force-reload)
do_stop
do_start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac