-
Notifications
You must be signed in to change notification settings - Fork 9
/
run.sh
executable file
·61 lines (56 loc) · 1.65 KB
/
run.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
BASEDIR=~/Applications/unifi-video
IP=0.0.0.0
NAME=unifi-video
VERSION=v3.10.13
# Run docker once to create a container and return the ID
# For following startups, use 'docker start <containerID>'
CONTAINER=`docker ps -a --filter ancestor=exsilium/unifi-video:$VERSION --format "{{.ID}}"`
if [ ! -z $CONTAINER ]
then
echo "There seems to be an existing container with the ancestor image. Please use 'docker start <containerID> to start it."
docker ps -a --filter ancestor=exsilium/unifi-video:$VERSION --format "table {{.ID}}\t{{.Names}}\t{{.CreatedAt}}\t{{.Status}}"
echo "==> Exiting without doing anything!"
else
printf "Checking for Host data volumes and directories: MongoDB-"
if [ -d $BASEDIR/mongodb ]
then
printf "OK"
else
printf "NOK\n"
echo "Please make sure you have created the following directory: $BASEDIR/mongodb"
exit 1;
fi
printf " | Unifi-Video-"
if [ -d $BASEDIR/unifi-video ]
then
printf "OK"
else
printf "NOK\n"
echo "Please make sure you have created the following directory: $BASEDIR/unifi-video"
exit 1;
fi
printf " | Log-"
if [ -d $BASEDIR/unifi-video/logs ]
then
printf "OK"
else
printf "NOK\n"
echo "Please make sure you have created the following directory: $BASEDIR/unifi-video/logs"
exit 1;
fi
printf "\n"
docker run -d --privileged \
-v $BASEDIR/mongodb:/var/lib/mongodb \
-v $BASEDIR/unifi-video:/var/lib/unifi-video \
-p $IP:6666:6666 \
-p $IP:7080:7080 \
-p $IP:7442:7442 \
-p $IP:7443:7443 \
-p $IP:7445:7445 \
-p $IP:7446:7446 \
-p $IP:7447:7447 \
--name $NAME \
--restart=unless-stopped \
exsilium/unifi-video:$VERSION
fi