forked from simonszu/ebooks-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
33 lines (24 loc) · 817 Bytes
/
run.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
#!/bin/sh
# Copy bot to mounted app folder if an empty folder is mounted
# Substitute environment variables in this step
if [ ! -f /app/bots.rb ]; then
echo "Installing bot..."
envsubst < /template/bots.rb | tee /app/bots.rb
echo
fi
# Template the config files with the environment vars
echo "Configuring CLI access for tweet fetching..."
envsubst < /template/ebooksrc | tee /root/.ebooksrc
envsubst < /template/import.sh | tee /ebooks/import.sh
chmod +x /ebooks/import.sh
echo
# Copy share-populating bots.rb to the real ebooks location
cp /app/bots.rb /ebooks/bots.rb
# Build the model and stuff
echo "Fetching tweets, building model..."
/ebooks/import.sh
cd /ebooks
echo "Starting cron for periodic fetching, starting bot..."
#tail -f /dev/null
#ebooks start
/usr/sbin/crond -f -l 8 & ebooks start