Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

init scripts

  • Loading branch information...
commit 1b4c96dea768f41adf88d8167f0d28b2e15bb314 1 parent 51d9991
@jyr authored
View
1  .gitignore
@@ -1,3 +1,4 @@
.DS_Store
src/
logs/mysql_error_log.err
+*.pid
View
3  init/check.sh
@@ -0,0 +1,3 @@
+#/bin/sh
+
+export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
View
20 init/mysql.sh
@@ -1,2 +1,20 @@
#/bin/sh
-/Applications/MEMP/Library/mysql/bin/mysqld_safe --port=3306 --socket=/Applications/MEMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --datadir=/Applications/MEMP/Library/mysql/data --pid-file=/Applications/MEMP/tmp/mysql/mysql.pid --log-error=/Applications/MEMP/logs/mysql_error_log &
+
+__show_usage( ) {
+
+ echo "Usage: ${0} {start|stop}"
+ exit 3
+}
+
+
+case "${1}" in
+ start)
+ /Applications/MEMP/Library/mysql/bin/mysqld_safe --port=3306 --socket=/Applications/MEMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --datadir=/Applications/MEMP/Library/mysql/data --pid-file=/Applications/MEMP/tmp/mysql/mysql.pid --log-error=/Applications/MEMP/logs/mysql_error_log &
+ ;;
+ stop)
+ /Applications/MEMP/Library/mysql/bin/mysqladmin -u root --socket=/Applications/MEMP/tmp/mysql/mysql.sock shutdown
+ ;;
+ *)
+ __show_usage
+ ;;
+esac
View
55 init/nginx.sh
@@ -1,2 +1,55 @@
#/bin/sh
-/Applications/MEMP/Library/nginx/nginx
+
+NGINX_BASE_DIR="/Applications/MEMP/Library/nginx"
+NGINX_DAEMON="${NGINX_BASE_DIR}/nginx"
+NGINX_CONF="/Applications/MEMP/conf/nginx/nginx.conf"
+
+__launch_signal( ) {
+
+ ${NGINX_DAEMON} -s ${1} &>/dev/null
+}
+
+__checkconfig( ) {
+
+ ${NGINX_DAEMON} -c ${NGINX_CONF} -t &>/dev/null
+}
+
+__start( ) {
+
+ [ -r ${NGINX_CONF} ] || exit 1
+
+ __checkconfig && ${NGINX_DAEMON} -c ${NGINX_CONF} &>/dev/null || return ${?}
+}
+
+__stop( ) {
+
+ __launch_signal stop
+}
+
+__reload( ) {
+
+ __checkconfig && __launch_signar reload || return ${?}
+}
+
+__restart( ) {
+
+ __stop && __start
+}
+
+__show_usage( ) {
+
+ echo "Usage: ${0} {start|stop|restart|reload}"
+ exit 3
+}
+
+##
+# :: main ::
+case "${1}" in
+ start|stop|restart|reload)
+ [ -x ${NGINX_DAEMON} ] || exit 2
+ __${1}
+ ;;
+ *)
+ __show_usage
+ ;;
+esac
View
30 init/php-fpm.sh
@@ -1,2 +1,30 @@
#/bin/sh
-/Applications/MEMP/Library/php/sbin/php-fpm start
+
+__show_usage( ) {
+
+ echo "Usage: ${0} {start|stop|quit|restart|reload|logrotate}"
+ exit 3
+}
+
+__create_alias( ) {
+ if [ ! -d "/usr/local/mysql" ]; then
+ ln -s /Applications/MEMP/Library/mysql /usr/local/mysql
+ fi
+}
+
+__export_library( ){
+ if [ $DYLD_LIBRARY_PATH = "" ]; then
+ export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
+ fi
+}
+
+case "${1}" in
+ start|stop|quit|restart|reload|logrotate)
+ __create_alias
+ __export_library
+ /Applications/MEMP/Library/php/sbin/php-fpm ${1}
+ ;;
+ *)
+ __show_usage
+ ;;
+esac
View
1  tmp/php/php-fpm.pid
@@ -0,0 +1 @@
+66420
Please sign in to comment.
Something went wrong with that request. Please try again.