#!/bin/bash
#Put start commands here
### Postgres ###
# echo "Starting postgres"
# /etc/init.d/postgresql start
### Tomcat ###
echo "Starting tomcat"
/etc/init.d/tomcat8 start
### Handle server ###
HANDLE_SERVER=/etc/init.d/handle-server
if [[ -r $HANDLE_SERVER ]]; then
    echo "Starting handle server";
    $HANDLE_SERVER start;
else
    echo "Handle server not present - ignoring start command";
fi

### nginx ###
echo "Starting nginx"
/etc/init.d/nginx start

### supervisor (shibboleth + fastcgi) ###
# make sure supervisord is running
/sbin/start-stop-daemon -p /tmp/supervisord.pid --start --exec /usr/bin/python -- /usr/local/bin/supervisord -c /etc/supervisord.conf
echo "Starting all supervised programs"
supervisorctl start all

### apache ###
#echo "Starting apache"
#apache2ctl start
### shibboleth ###
#echo "Starting shibboleth"
#/etc/init.d/shibd start
