-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstart_wikispeech.sh
123 lines (98 loc) · 3.43 KB
/
start_wikispeech.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bash
set -e
CMD=`basename $0`
rundir=`pwd`
defaultlogdir=$rundir/log
defaultgitrepos=`ls -d $HOME/git* 2> >(grep -v 'No such file' >&2) | egrep "(git|git_repos|gitrepos)$" | head -1`
if [ -z $defaultgitrepos ]; then
defaultgitrepos=$HOME/gitrepos
fi
defaultlexserverappdir="$HOME/wikispeech"
defaultsleep=30
gitrepos=$defaultgitrepos
logdir=$defaultlogdir
lexserverappdir=$defaultlexserverappdir
sleep=$defaultsleep
printUsage() {
echo "Usage:" 2>&1
echo " $ $CMD <options>" >&2
echo " -g gitroot - root folder for git repositories mishkal, marytts, ahotts, symbolset, pronlex, wikispeech-server (default $defaultgitrepos)" >&2
echo " -d lexserver appdir - location of the lexserver installation (default $defaultlexserverappdir)" >&2
echo " -l logdir - log files folder (default $defaultlogdir)" >&2
echo " -s sleep - sleep seconds after starting sub-services before starting the main server (default $defaultsleep)" >&2
}
while getopts "hg:l:d:s:" opt; do
case $opt in
h) printUsage && exit 1;;
g)
gitrepos=$OPTARG
;;
d)
lexserverappdir=$OPTARG
;;
l)
logdir=$OPTARG
;;
s)
sleep=$OPTARG
;;
\?) ERR=1 && echo "" >&2
esac
done
shift $(expr $OPTIND - 1 )
if [ $# -ne 0 ]; then
echo "[$CMD] Invalid option(s): $*" >&2
exit 1
fi
if [ $gitrepos ] && [ -d $gitrepos ]; then
echo -n ""
else
echo "[$CMD] No gitrepos folder found in default location: $gitrepos"
printUsage
exit 1
fi
if [ $lexserverappdir ] && [ -d $lexserverappdir ]; then
echo -n ""
else
echo "[$CMD] No lexserver appdir found in default location: $lexserverappdir"
printUsage
exit 1
fi
wikispeech=`ls -d $gitrepos/wikispeech*server 2> >(grep -v 'No such file' >&2) | head -1`
if [ $wikispeech ] && [ -d $wikispeech ]; then
echo -n ""
else
echo "[$CMD] No wikispeech git folder found in default location: $gitrepos/wikispeech-server or $gitrepos/wikispeech_server"
printUsage
exit 1
fi
mkdir -p $logdir
echo "[$CMD] gitrepos folder: $gitrepos" >&2
echo "[$CMD] wikispeech git folder: $wikispeech" >&2
echo "[$CMD] lexserver appdir: $lexserverappdir" >&2
echo "[$CMD] logdir: $logdir" >&2
echo "[$CMD] starting pronlex" >&2
cd $gitrepos/pronlex/ && nohup bash scripts/start_server.sh -e sqlite -a $lexserverappdir &>> $logdir/pronlex.log &
echo "[$CMD] starting mapper" >&2
cd $gitrepos/symbolset/server && go run . -ss_files $lexserverappdir/symbol_sets &>> $logdir/mapper.log &
echo "[$CMD] starting mishkal" >&2
cd $gitrepos/mishkal/ && nohup python interfaces/web/mishkal-webserver.py &>> $logdir/mishkal.log &
echo "[$CMD] starting marytts" >&2
cd $gitrepos/marytts && nohup ./gradlew run &>> $logdir/marytts.log &
# echo "[$CMD] TESTING -- not starting ahotts, wikispeech" >&2 && exit 0
echo "[$CMD] starting ahotts" >&2
cd $gitrepos/AhoTTS-eu-Wikispeech && nohup sh start_ahotts_wikispeech.sh &>> $logdir/ahotts.log &
#echo "[$CMD] TESTING -- not starting wikispeech" && exit 0
echo "[$CMD] clearing wikispeech audio cache" >&2
cd $wikispeech && bash clear_audio_cache.sh -q || exit 1
echo "[$CMD] waiting $sleep secs before starting main wikispeech server" >&2
for i in `seq 1 $sleep`;
do
echo -en "\r - time elapsed: ${i}s" >&2 ;
sleep 1
done
echo "" >&2
echo "[$CMD] starting main wikispeech server" >&2
cd $wikispeech && nohup python3 bin/wikispeech &>> $logdir/wikispeech.log &
echo ""
echo "[$CMD] check logs in folder $logdir for process details" >&2