You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Apache Wiki <wi...@apache.org> on 2005/07/10 14:56:08 UTC
[Lenya Wiki] Update of "initScript" by NewPhone
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Lenya Wiki" for change notification.
The following page has been changed by NewPhone:
http://wiki.apache.org/lenya/initScript
New page:
This is an example iniit script for lenya.
[[BR]]
{ { {
#!/bin/sh
#
# LENYA - start and stop the LENYA client daemon on Unix
#
# config: /etc/sysconfig/lenya
#
### BEGIN INIT INFO
# Provides: lenya
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Description: This script starts the local LENYA client as a daemon
# For more information about LENYA (the Berkeley Open Infrastructure
# for Network Computing) see http://lenya.ssl.berkeley.edu
### END INIT INFO
########################################################################
# Defaults, which can be overridden by /etc/sysconfig/lenya
LENYAUSER=lenya
LENYADIR=/home/lenya/apache-lenya-1.2.3-src
LOGFILE=/var/log/lenya.log
ERRORLOG=$LOGFILE
# Just set the path to what is needed, nothing more (for security)
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
# Init script function library. This stuff is Red Hat specific,
# but if the functions are not found we create our own simple replacements.
if [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
function echo_success () { echo -n " [ OK ] " ; }
function echo_failure () { echo -n " [FAILED] " ; }
function echo_warning () { echo -n " [WARNING] " ; }
function killproc() {
PID=`pidof -s -x -o $$ -o $PPID -o %PPID $1`
[ $PID ] && kill $PID ; }
fi
# su on Linux seems to need this to be set to work properly
export TERM dumb
# Look for any local configuration settings:
if [ -f /etc/sysconfig/lenya ]; then
. /etc/sysconfig/lenya
fi
## Locate the working directory
if [ ! -d $LENYADIR ]; then
echo "Cannot find LENYA directory $LENYADIR "
exit 7
fi
## Locate the executable, either lenya_client,
## or lenya with highest version number
LENYAEXE=$LENYADIR/lenya.sh
if [ ! -x $LENYAEXE ]; then
LENYAEXE=`/bin/ls -1 $LENYADIR/lenya_*_$BUILD_ARCH 2>/dev/null | tail -1 `
fi
if [ ! -x "$LENYAEXE" ]; then
echo "Cannot find/run LENYA executable. $LENYAEXE "
exit 2
fi
## Functions: $1 is start/stop/status/restart
case "$1" in
start)
cd $LENYADIR
echo -n "Starting LENYA server as a daemon: "
su $LENYAUSER -c "$LENYAEXE servlet-admin" >>$LOGFILE 2>>$ERRORLOG &
sleep 1
PID=`pidof -s -x -o $$ -o $PPID -o %PPID $LENYAEXE`
if [ $PID ]; then
touch $LOCKDIR/lenya
echo_success
else
echo_failure
fi
echo
;;
stop)
cd $LENYADIR
echo -n "Stopping LENYA client daemon: "
wget -q -O /dev/null http://127.0.0.1:8889/?A=Exit%20All%20Servers && echo_success || echo_failure
# clean up in any case
rm -f $LOCKDIR/lenya
echo
;;
restart)
$0 stop
$0 start
;;
status)
PID=`pidof -x -o $$ -o $PPID -o %PPID lenya_client`
if [ "$PID" == "" ]; then
PID=`pidof -x -o $$ -o $PPID -o %PPID $LENYAEXE`
fi
if [ "$PID" != "" ]; then
echo "LENYA client is running (pid $PID)."
else
if [ -f $LOCKDIR/lenya ]; then
echo "LENYA is stopped but lockfile exists."
else
echo "LENYA client is stopped."
fi
fi
;;
*)
echo "Usage: lenya {start|stop|restart|status}"
exit 1
esac
exit
} } }
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org