Skip to content

Instantly share code, notes, and snippets.

@kotashiratsuka
Created June 9, 2014 03:42
Show Gist options
  • Save kotashiratsuka/0aeff93373fc1cde140f to your computer and use it in GitHub Desktop.
Save kotashiratsuka/0aeff93373fc1cde140f to your computer and use it in GitHub Desktop.
mysql-proxy.init
#!/bin/bash
#
# Mysql Proxy
# Author : @kotashiratsuka
# App Version : 5.6
# chkconfig: 2345 82 55
# processname: mysql-proxy
# description: Runs mysql-proxy
# Include RedHat function library
. /etc/rc.d/init.d/functions
# The username and path to the gitlab source
USER=root
PROXY_PATH=/opt/mysql-proxy/bin/mysql-proxy
PROXY_PID=/var/run/mysql-proxy.pid
PNAME=mysql-proxy
start() {
echo -n $"Starting mysql-proxy: "
daemon --user=$USER $PROXY_PATH --daemon --pid-file=$PROXY_PID --log-use-syslog
RETVAL=$?
echo
}
stop() {
echo -n $"Stopping mysql-proxy: "
killproc -p $PROXY_PID
RETVAL=$?
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status -p ${PROXY_PID}
;;
*)
echo "Usage: $0 {start|stop|restart|status}" >&2
RETVAL=1
;;
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment