-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDO_FBK-subtitler_start.sh
63 lines (51 loc) · 1.55 KB
/
DO_FBK-subtitler_start.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
#! /bin/bash
if test -L $0 ; then exe=$(readlink -e $0) ; else exe=$0 ; fi
wDir=$(cd $(dirname $exe) ; pwd) ; unset exe
if test -z "${FBK_DATA_PATH}"
then
echo 'cannot find enviroment variable FBK_DATA_PATH: please set it with the path of the directory "FBK_data"'
exit 1
fi
if ! test -d "${FBK_DATA_PATH}"
then
echo 'ERROR: the value of the enviroment variable FBK_DATA_PATH is not a directory: please set it with the path of the directory "FBK_data"'
exit 1
fi
if ! test -d "${FBK_DATA_PATH}/.cache"
then
echo 'ERROR: the value of the enviroment variable FBK_DATA_PATH does not appear to contain the correct directory "FBK_data": please set it with the path of the directory "FBK_data"'
exit 1
fi
dataDir=${FBK_DATA_PATH}
startMainDocker() {
dockerImg=$1
dockerNet="fbk"
dockerName=main
#
docker network ls | grep ${dockerNet} &> /dev/null || docker network create ${dockerNet}
#
pars="--runtime=nvidia -d --rm -it -p 8080:8080"
pars="$pars --net $dockerNet --name $dockerName"
pars="$pars --shm-size 8G"
pars="$pars -v ${FBK_DATA_PATH}/.cache:/root/.cache"
#
if test $# -gt 1
then
echo docker run $pars $dockerImg $cmd
fi
#
cId=$(docker run $pars $dockerImg)
echo successfully started $dockerName docker container $cId
}
# 1) start the pipeline main
#
dockerImg="fbk_subtitler:v1.2.1"
if docker container ls -a | grep "$dockerImg" &> /dev/null
then
echo pipeline main container is already running
else
echo starting docker container pipeline main
startMainDocker $dockerImg "$@"
fi
echo
echo FBK subtitler ready