Running as a service on Linux

Running JReport Server as an OS service on Linux is more or less the same as with running on Unix. Here it is assumed that your default start up rc is rc5.

Setting up XVFB

  1. Install XVFB.
  2. Write a script /etc/init.d/xvfb as follows, and make it executable.
    #!/bin/sh
    mode=$1
    case "$mode" in
    'start')
    echo "start xvfb "
    if [ -f /usr/X11R6/bin/Xvfb ]
    then
    /usr/X11R6/bin/Xvfb :1 -screen 0 1152x900x8 &
    fi
    ;;
    *)
    echo " Usage: "
    echo " $0 start (start XVFB)"
    echo " $0 stop (stop XVFB not support)"
    exit 1
    esac
    exit 0
  3. Create a soft link to /etc/rc5.d/S97xvfb.

    ln -s /etc/init.d/xvfb /etc/rc5.d/S97xvfb

Using rc to run JReport Server as a service

Assuming that JReport Server has been installed to /JReport/Server.

  1. Write a script /JReport/Server/bin/JRServer as shown below, and make it executable. Here it is assumed that JReport Server is running on a machine with IP address 127.0.0.1.
    #!/bin/sh
    DISPLAY=127.0.0.1:1.0
    export DISPLAY
    /JReport/Server/bin/JRServer -silent "$@"
  2. Write a script /etc/init.d/jrserver as follows, and make it executable.
    #!/bin/sh
    mode=$1
    if [ ! -d /JReport/Server ]
    then # JReport not installed
    exit 1
    fi
    case "$mode" in
    'start')
    if [ -d /JReport/Server ]
    then
    echo "Starting JReport Server"
    cd /JReport/Server/bin/;
    JRServer -silent & 
    fi
    ;;
    'stop')
    if [ -d /JReport/Server ]
    then
    echo "Stopping JReport Server" 
    /JReport/Server/bin/CmdSender localshutdown &
    fi
    ;;
    *)
    echo " Usage: "
    echo " $0 start (start JReport Server)"
    echo " $0 stop (stop JReport Server)"
    exit 1
    ;;
    esac
    exit 0
  3. Create a soft link to /etc/rc5.d/S98jrserver.

    ln -s /etc/init.d/jrserver /etc/rc5.d/S98jrserver

  4. Create a soft link to /etc/rc5.d/K98jrserver.

    ln -s /etc/init.d/jrserver /etc/rc5.d/K98jrserver

If all has been carried out successfully, the installation of the service will now have finished. JReport Server is now ready to run as a daemon process.