| 1 | |
| 2 | |
| 3 | |
| 4 | su -s /bin/sh postgres <<EOF |
| 5 | cd |
| 6 | if [ ! -d data ];then |
| 7 | echo 'No data found, initializing postgres.' |
| 8 | mkdir data |
| 9 | chmod 700 data |
| 10 | initdb -D data > /dev/null 2> /dev/null |
| 11 | echo "host all all 0.0.0.0/0 md5" >> /var/lib/postgresql/data/pg_hba.conf |
| 12 | echo "listen_addresses='*'" >> /var/lib/postgresql/data/postgresql.conf |
| 13 | sed -i '/unix_socket_directories/d' /var/lib/postgresql/data/postgresql.conf |
| 14 | echo 'Postgres initialized' |
| 15 | fi |
| 16 | pg_ctl start -D /var/lib/postgresql/data > /dev/null |
| 17 | echo 'Postgres Ready' |
| 18 | EOF |
| 19 | |
| 20 | |
| 21 | if [ ! "$(ls /etc/nginx)" ];then |
| 22 | echo 'Moving sample into nginx' |
| 23 | cp -r /sample/nginx/* /etc/nginx |
| 24 | fi |
| 25 | nginx |
| 26 | tail -f /var/log/nginx/access.log & |
| 27 | |
| 28 | |
| 29 | redis-server > /dev/null & |
| 30 | |
| 31 | |
| 32 | $@ |