createDictionaries.sh
1.63 KB
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
#!/bin/bash
LC_PAPER=pl_PL.UTF-8
LC_ADDRESS=pl_PL.UTF-8
LC_MONETARY=pl_PL.UTF-8
TERM=xterm-256color
SHELL=/bin/bash
LC_NUMERIC=pl_PL.UTF-8
SSH_TTY=/dev/pts/1
LC_ALL=en_US.UTF-8
USER=zil
LC_TELEPHONE=pl_PL.UTF-8
MAIL=/var/mail/zil
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
LC_COLLATE=pl_PL.utf8
LC_IDENTIFICATION=pl_PL.UTF-8
PWD=/home/zil/multiservice/scripts
LANG=en_US.UTF-8
LC_MEASUREMENT=pl_PL.UTF-8
SHLVL=1
HOME=/home/zil
LANGUAGE=en_US.UTF-8
LOGNAME=zil
LESSOPEN=| /usr/bin/lesspipe %s
LC_TIME=pl_PL.UTF-8
LC_NAME=pl_PL.UTF-8
_=/usr/bin/env
OLDPWD=/home/zil/multiservice
# change to the script's directory
cd "$(dirname "$0")"
LOCKFILE=createDictionaries.lck
[ -f $LOCKFILE ] && exit
touch $LOCKFILE
if [ -f /tmp/dictionariestodelete ]
then
if [ -s /tmp/dictionariestodelete ]
then
echo "Deleting dictionaries"
for dname in `cat /tmp/dictionariestodelete`
do
echo Deleting $dname
rm -f ../../config/dictionaryannotator/$dname*
rm -f uploads/$dname*
done
./options_creator.py
./restart_services.sh
> /tmp/dictionariestodelete
fi
fi
for filePath in `ls /tmp/multiservicedict_*`
do
fileName=`basename $filePath`
dictionaryFileName=${fileName:17}
dictionaryName=`echo "$dictionaryFileName" | cut -d'.' -f1`
echo `date`" processing: "$filePath" as the "$dictionaryName" dictionary"
if [ -s $filePath ]
then
cp $filePath uploads/$dictionaryName.raw
> $filePath
else
echo "The dictionary file: $filePath already processed"
fi
done
make
rm $LOCKFILE