forked from ampache/ampache-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
34 lines (26 loc) · 1.18 KB
/
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
34
#!/bin/bash
sleep 10
## Perform variable substitution in /var/www/config/ampache.cfg.php
echo "Setting variables in /var/www/config/ampache.cfg.php"
# Do *not* invert the order of sedding LOCAL_WEB_PATH and WEB_PATH
sed "s/LOCAL_WEB_PATH/$LOCAL_WEB_PATH/" -i /var/www/config/ampache.cfg.php
sed "s/WEB_PATH/$WEB_PATH/" -i /var/www/config/ampache.cfg.php
sed "s/DATABASE_HOSTNAME/$DATABASE_HOSTNAME/" -i /var/www/config/ampache.cfg.php
sed "s/DATABASE_PORT/$DATABASE_PORT/" -i /var/www/config/ampache.cfg.php
sed "s/DATABASE_NAME/$DATABASE_NAME/" -i /var/www/config/ampache.cfg.php
sed "s/DATABASE_USERNAME/$DATABASE_USERNAME/" -i /var/www/config/ampache.cfg.php
sed "s/DATABASE_PASSWORD/$DATABASE_PASSWORD/" -i /var/www/config/ampache.cfg.php
sed "s/SECRET_KEY/$SECRET_KEY/" -i /var/www/config/ampache.cfg.php
echo "Generated config (comments ignored):"
grep -v "^;" /var/www/config/ampache.cfg.php | \
sed 's/[[:blank:]]//' | grep -v "^$"
# Start apache in the background
service apache2 start
# Start cron in the background
cron
# Start a process to watch for changes in the library with inotify
while true; do
inotifywatch /media
php /var/www/bin/catalog_update.inc -a
sleep 30
done