Watching our visitors and how they arrive on warp11.com I cam across this page:
http://krisrice.blogspot.com/2010/12/listener-startupshutdown-script.html
definately worthwile caching… here we go:
Kris gives a script, which I altered a little bit.
#!/bin/sh
#
#
# chkconfig: 2345 80 05
# description: This is a program that is responsible for taking care of
# starting the apex-listener as a service.
#
# processname: apxlistener
# Red Hat or SuSE config: /etc/sysconfig/apxlistener
# Debian or Ubuntu config: /etc/default/apxlistener
#
. /etc/rc.d/init.d/functions
NAME="Oracle Application Express Listener"
JAVA="/usr/java/jdk1.7.0_04/bin/java"
APEX_LISTENER_HOME="/u01/app/oracle/product/1.1.3/apex-listener"
APEX_IMAGES="/u01/app/oracle/product/4.1/apex/images/"
LOGFILE="$APEX_LISTENER_HOME/apex_listener.log"
PIDFILE="$APEX_LISTENER_HOME/apex_listener.pid"
start() {
echo -n "Starting $NAME: "
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
echo APEX Listener already running: $PID
exit 2;
else
nohup $JAVA -Dapex.home="$APEX_LISTENER_HOME/tmp.apxlistener" -Dapex.images="$APEX_IMAGES" -Dapex.port=8080 -jar "$APEX_LISTENER_HOME/apex.war" 2>&1 > $LOGFILE &
RETVAL=$!
echo Started PID: $RETVAL
echo
echo $RETVAL >>$PIDFILE
return $RETVAL
fi
}
status() {
echo -n "Status $NAME: "
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
echo APEX Listener already running: $PID
ps -ef | grep $PID
else
echo APEX Listener not running
fi
}
stop() {
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
echo -n "Shutting down $NAME PID:$PID"
echo
kill $PID
rm -f $PIDFILE
else
echo APEX Listener not running
fi
return 0
}
log() {
tail -f $LOGFILE
}
info() {
echo Before first use you must run the command below manually to initiate the service.
echo
echo $JAVA -Dapex.home="$APEX_LISTENER_HOME/tmp.apxlistener" -Dapex.images="$APEX_IMAGES" -Dapex.port=8080 -jar "$APEX_LISTENER_HOME/apex.war"
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
log)
log
;;
info)
info
;;
*)
echo
echo "Usage: {start|stop|status|restart|log|info}"
echo
info
exit 1
;;
esac
exit $?
You should edit highlighted lines:
JAVA: the location of your JDK. be advised the minimum version your listener needs
APEX_LISTENER_HOME: the location the listener uses to store its config files
APEX_IMAGES: the location of the apex images directory
Create the file as /etc/init.d/apxlistener
Now set it as executable
chmod a+x /etc/init.d/apxlistener
add it to the startup-list:
chkcondig --add apxlistener
chkconfig apxlistener on
Now we’re allmost there. The listener needs a console to do the initial configuration. If you would start the service as is, it will not have a console.
I added an option “info” that echoes the commandline the service will use:
so.. execute:
/etc/init.d/apxlistener info
will give you something like this:
Before first use you must run the command below manually to initiate the service.
/usr/java/jdk1.7.0_04/bin/java -Dapex.home=/u01/app/oracle/product/1.1.3/apex-listener/tmp.apxlistener -Dapex.images=/u01/app/oracle/product/4.1/apex/images/ -Dapex.port=8080 -jar /u01/app/oracle/product/1.1.3/apex-listener/apex.war
execute that line in your console, it will ask for two usernames ( I used “admin” in both cases) and passwords.
Enter them as requested after which you can go to http://yourserver:8080/apex/listernerConfigure
Here you can enter your details as described in the apex listener.
after a reboot the listener should start automatically.