### Running as a service on Linux

Running JReport Enterprise 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.

Note: To run JReport Enterprise Server on Linux, your JDK version must be of version 1.4 or above.

#### Setting up XVFB

1. Install XVFB.
2. Write a script `/etc/init.d/xvfb` as below, 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 Enterprise Server as a service

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

1. Write a script `/JReport/Server/bin/JREntServer` as shown below, and make it executable. Here it is assumed that JReport Enterprise 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/JREntServer -silent "$@"

2. Write a script `/etc/init.d/jrserver` as below, 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 Enterprise Server"
       cd /JReport/Server/bin/;
       JREntServer -silent &
       fi
       ;;
       'stop')
       if [ -d /JReport/Server ]
       then
       echo "Stopping JReport Enterprise Server"
       /JReport/Server/bin/CmdSender localshutdown &
       fi
       ;;
       *)
       echo " Usage: "
       echo " $0 start (start JReport Enterprise Server)"
       echo " $0 stop (stop JReport Enterprise 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 Enterprise Server is now ready to run as a daemon process.