Archive for April, 2008

LAMPP / XAMPP start up script for CentOS / Fedora / Red Hat

Tuesday, April 22nd, 2008

Here is a little script that may help you out if you want to start LAMPP as a service on linux using chkconfig and service commands.

Place the following code in “/etc/init.d/” with the file name “lampp” and make sure it is executable.

#!/bin/sh
#
# author: william ruckman ruckman.net
#
# chkconfig: 2345 98 83
#
# description: Starts and stops the LAMPP Server
#
# processname: lampp

# Source function library
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = “no” ] && exit 0

RETVAL=0
# See how we were called.
case “$1″ in
start)
echo -n “Starting lampp service: ”
echo ” ”
cd /opt/lampp/
./lampp start
sleep 1
RETVAL=$?
;;
stop)
echo -n “Stopping lampp service: ”
echo ” ”
cd /opt/lampp/
./lampp stop
sleep 1
RETVAL=$?
;;
restart|reload)
echo -n “Restarting lampp service: ”
echo ” ”
cd /opt/lampp/
./lampp restart
sleep 1
RETVAL=$?
;;
status)
echo -n “Checking lampp service: ”
echo ” ”
cd /opt/lampp/
./lampp status
sleep 1
RETVAL=$?
;;
*)
echo “Usage: lampp {start|stop|restart|reload|status}”
echo ” ”
exit 1
esac

exit $RETVAL

Happy coding!