--- examples/haproxy.init	2015-02-01 06:54:32.000000000 +0000
+++ haproxy.init.	2015-09-15 13:09:21.847003809 +0000
@@ -32,19 +32,25 @@
   BASENAME=`basename $BASENAME`
 fi
 
-[ -f /etc/$BASENAME/$BASENAME.cfg ] || exit 1
+config=/etc/$BASENAME/$BASENAME.cfg
+pidfile=/var/run/$BASENAME.pid
+opts=""
+
+[ -f /etc/sysconfig/$BASENAME ] && . /etc/sysconfig/$BASENAME
+
+[ -f $config ] || exit 1
 
 RETVAL=0
 
 start() {
-  /usr/sbin/$BASENAME -c -q -f /etc/$BASENAME/$BASENAME.cfg
+  /usr/sbin/$BASENAME -c -q -f $config
   if [ $? -ne 0 ]; then
     echo "Errors found in configuration file, check it with '$BASENAME check'."
     return 1
   fi
 
   echo -n "Starting $BASENAME: "
-  daemon /usr/sbin/$BASENAME -D -f /etc/$BASENAME/$BASENAME.cfg -p /var/run/$BASENAME.pid
+  daemon /usr/sbin/$BASENAME -D -f $config -p $pidfile $opts
   RETVAL=$?
   echo
   [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
@@ -57,12 +63,12 @@
   RETVAL=$?
   echo
   [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASENAME
-  [ $RETVAL -eq 0 ] && rm -f /var/run/$BASENAME.pid
+  [ $RETVAL -eq 0 ] && rm -f $pidfile
   return $RETVAL
 }
 
 restart() {
-  /usr/sbin/$BASENAME -c -q -f /etc/$BASENAME/$BASENAME.cfg
+  /usr/sbin/$BASENAME -c -q -f $config $opts
   if [ $? -ne 0 ]; then
     echo "Errors found in configuration file, check it with '$BASENAME check'."
     return 1
@@ -72,16 +78,16 @@
 }
 
 reload() {
-  /usr/sbin/$BASENAME -c -q -f /etc/$BASENAME/$BASENAME.cfg
+  /usr/sbin/$BASENAME -c -q -f $config
   if [ $? -ne 0 ]; then
     echo "Errors found in configuration file, check it with '$BASENAME check'."
     return 1
   fi
-  /usr/sbin/$BASENAME -D -f /etc/$BASENAME/$BASENAME.cfg -p /var/run/$BASENAME.pid -sf $(cat /var/run/$BASENAME.pid)
+  /usr/sbin/$BASENAME -D -f $config -p $pidfile $opts -sf $(cat $pidfile)
 }
 
 check() {
-  /usr/sbin/$BASENAME -c -q -V -f /etc/$BASENAME/$BASENAME.cfg
+  /usr/sbin/$BASENAME -c -q -V -f $config
 }
 
 rhstatus() {
