-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd.sh
executable file
·64 lines (49 loc) · 1.92 KB
/
cmd.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
#!/bin/bash
function usage {
cat <<EOF
$(basename ${0}) is used for EPGStation docker-compose
Usage:
$(basename ${0}) [command]
Arguments:
start Start EPGStation docker container
stop Stop EPGStation docker container
restart Restart EPGStation docker container
logs Show logs of EPGStation docker container
setup Delete config files and generate new config files from template
It may be lost your settings
EOF
}
################
project_name='epgstation'
compose_file='docker-compose.yml'
mirakurun_host=$(cat misc.conf | grep mirakurun_host | sed -r 's/^\s*mirakurun_host\s(.+)\s*$/\1/')
export MIRAKURUN_IP=$(getent ahosts ${mirakurun_host} | grep STREAM | grep -v : | sed -r 's/^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*$/\1/')
if [ -z $1 ]; then
usage
exit 1
fi
if [ $1 = 'start' ]; then
echo 'Start EPGStation'
docker-compose -p ${project_name} -f ${compose_file} up -d
fi
if [ $1 = 'stop' ]; then
echo 'Stop EPGStation'
docker-compose -p ${project_name} -f ${compose_file} stop
fi
if [ $1 = 'restart' ]; then
echo 'Restart EPGStation'
docker-compose -p ${project_name} -f ${compose_file} stop
docker-compose -p ${project_name} -f ${compose_file} up -d
fi
if [ $1 = 'logs' ]; then
docker-compose -p ${project_name} -f ${compose_file} logs epgstation
fi
if [ $1 = 'setup' ]; then
echo 'Generate config files'
cp docker-compose-sample.yml docker-compose.yml
cp epgstation/config/enc.js.template epgstation/config/enc.js
cp epgstation/config/config.yml.template epgstation/config/config.yml
cp epgstation/config/operatorLogConfig.sample.yml epgstation/config/operatorLogConfig.yml
cp epgstation/config/epgUpdaterLogConfig.sample.yml epgstation/config/epgUpdaterLogConfig.yml
cp epgstation/config/serviceLogConfig.sample.yml epgstation/config/serviceLogConfig.yml
fi