-
Notifications
You must be signed in to change notification settings - Fork 2
/
start-truecommand
38 lines (33 loc) · 1.25 KB
/
start-truecommand
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
#!/bin/bash
# =====================================
# Script to launch TrueCommand docker container
# Contact iXsystems (http://ixsystems.com) for assistance
# =====================================
# Configuration options
# ----------------------------
port="80"
sslport="443"
version="latest"
datadir="/data"
# ============
#Main Script
if [ "${1}" = "stop" ] ; then
id=$(docker ps | grep "ixsystems/truecommand" | cut -d ' ' -f 1)
echo "Stopping TrueCommand container: ${id}"
docker stop "${id}"
exit $?
fi
# Step 1 : Pull latest version (can fail as needed if internet access unavailable)
docker pull "ixsystems/truecommand:${version}"
# Step 2 : Start the container
if [ ! -d "${datadir}" ] ; then
mkdir "${datadir}"
touch "${datadir}/.vm_wrapper" #in case we need to use this in the TC image for any special functionality later
fi
if [ "${1}" = "service" ] ; then
#Do not detach from the process. Service needs to know when it is stopped and should be restarted
docker run -v "${datadir}:/data" -p "${port}:80" -p "${sslport}:443" "ixsystems/truecommand:${version}"
else
#Manual run of the start script. Detach from the docker process
docker run --detach -v "${datadir}:/data" -p "${port}:80" -p "${sslport}:443" "ixsystems/truecommand:${version}"
fi