Jump to content
We've recently updated our Privacy Statement, available here ×

Auto-start on boot


synchro

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Those scripts won't work as supplied as the paths are all wrong, and the bundle doesn't include apache anyway (it's supplied by the OS). Since jasper does have a functional control script, I've rewritten the control script to use it and match the paths used by the install bundle, saved it at /etc/init.d/jasperserver and given it execute permissions:

#!/bin/sh### BEGIN INIT INFO# Provides:          jasperserver# Required-Start:# Required-Stop:# Default-Start:     2 3 4 5# Default-Stop:      0 1 6# Short-Description: Start JasperServer at boot time# Description:       Enable service provided by JasperServer.### END INIT INFOJASPER_HOME="/opt/jasperreports-server-cp-4.2.1"case "$1" in  start)    if [ -f $JASPER_HOME/ctlscript.sh ]; then      echo "Starting JasperServer"      $JASPER_HOME/ctlscript.sh start    fi    ;;  stop)    if [ -f $JASPER_HOME/ctlscript.sh ]; then      echo "Stopping JasperServer"      $JASPER_HOME/ctlscript.sh stop    fi    ;;  restart)    if [ -f $JASPER_HOME/ctlscript.sh ]; then      echo "Restarting JasperServer"      $JASPER_HOME/ctlscript.sh restart    fi    ;;  status)    if [ -f $JASPER_HOME/ctlscript.sh ]; then      $JASPER_HOME/ctlscript.sh status    fi    ;;  *)    echo $"Usage: $0 {start|stop|restart|status}"    exit 1    ;;esac

I don't think it's a good idea to name tomcat separately in this context as it may get confused with any system supplied script, and the jasper script controls more than one thing. I think the jasper control script would actually work directly as an init.d script, however it supports many other options that are possibly hazardous to normal operations, so this wrapper limits access to start/stop/restart/status.

The correct way to create startup links is not to manually create them as that article suggests, but to use one of the utilities provided by the OS to do it. Tomcat doesn't need apache in order to run jasper, though if you're proxying via apache (in order to avoid the :8080 URL) it won't work until apache is running, but since it's not a functional requirement I don't think it's necessary to describe it as a startup dependency as it will work if apache is started before or after tomcat, so the default startup priority should work fine. On Debian/Ubuntu you would do this:

update-rc.d jasperserver defaults

Controlling Jasper can then be done like this:

service jasperserver startservice jasperserver stopservice jasperserver restartservice jasperserver status

The headers in the startup script are for the upstart startup system that has been the recommended method on Ubuntu for the last few years.

If you list an OS as 'supported', I would really expect this to be there out of the box. Mind you, this is oddly common amongst Java apps - none of Atlassian's products have sensible startup scripts.

BTW the FCKEditor in this forum is an old and buggy version. Any chance of an update? I had to edit this post's source in an external editor to stop it messing it up.



Post Edited by synchro at 11/30/2011 10:10
Link to comment
Share on other sites

Thanks very much for sharing your solution for the auto-start on boot. You're absolutely right and I'm going to enter a bug about the script not being provided.

I'll tell Matthew we need to replace the editor, in case he hasn't heard.  Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...