#!/usr/bin/with-contenv bash

## Embedded DB Variance
  if [[ "$DB_EMBEDDED" = "TRUE" ]] && [[ "$DB_EMBEDDED" = "TRUE" ]];  then
     DB_EMBEDDED=TRUE
  else
     DB_EMBEDDED=FALSE      
  fi
  
fwconsole stop
service apache2 stop

if [ "$DB_EMBEDDED" = "TRUE" ];  then 
	service mysql stop
fi

mkdir -p /tmp/state
touch /tmp/state/10-freepbx-finish