Skip to content

Instantly share code, notes, and snippets.

@mesaque
Created May 30, 2018 16:49
Show Gist options
  • Save mesaque/c27d962b02593177c93aa4ecab1ee8db to your computer and use it in GitHub Desktop.
Save mesaque/c27d962b02593177c93aa4ecab1ee8db to your computer and use it in GitHub Desktop.
initializer.sh
#!/bin/bash
#services names
NGINX_SERVICE='nginx'
PHP5_SERVICE='php5-fpm'
PHP7_SERVICE='php-fpm7.0'
MYSQL_SERVICE='mysql'
#test if they are ready
NGINX_BIN=$(command -v $NGINX_SERVICE)
PHP5_BIN=$(command -v $PHP5_SERVICE)
PHP7_BIN=$(command -v $PHP7_SERVICE)
MYSQL_BIN=$(command -v $MYSQL_SERVICE)
[ $NGINX_BIN ] && $NGINX_BIN -g "daemon off;" &
[ $PHP5_BIN ] && $PHP5_BIN --nodaemonize &
[ $PHP7_BIN ] && $PHP7_BIN --nodaemonize &
[ $MYSQL_BIN ] && /etc/init.d/$MYSQL_SERVICE start &
while true; do sleep 1d; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment