### Running as a service on UNIX

Assuming that JReport Enterprise Server has been installed to `/user/report/jns`,

1. Write a script `/etc/init.d/jrserver` as below, and make it executable.

       #!/bin/sh
       mode=$1
       if [ ! -d /user/report/jns ]
       then # JReport not installed
       exit 1
       fi
       case "$mode" in
       'start')
       if [ -d /user/report/jns ]
       then
       echo "Starting JReport Enterprise Server"
       /user/report/jns/bin/NJREntServer.sh &
       fi
       ;;
       'stop')
       if [ -d /user/report/jns ]
       then
       echo "Stopping JReport Enterprise Server"
       /user/report/jns/bin/CmdSender.sh localshutdown &
       fi
       ;;
       *)
       echo " Usage: "
       echo " $0 start (start JReport Enterprise Server)"
       echo " $0 stop (stop JReport Enterprise Server)"
       exit 1
       ;;
       esac
       exit 0

2. Create a soft link to `/etc/rc2.d/S99jrserver`.

   ln `-s /etc/init.d/jrserver /etc/rc2.d/S99jrserver`

3. Create a soft link to `/etc/rc0.d/K99jrserver`.

   ln `-s /etc/init.d/jrserver /etc/rc0.d/K99jrserver`