Running as a service on Unix

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

  1. Write a script /etc/init.d/jrserver as follows, 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 Server"
    /user/report/jns/bin/NJRServer.sh &
    fi
    ;;
    'stop')
    if [ -d /user/report/jns ]
    then
    echo "Stopping JReport Server"
    /user/report/jns/bin/CmdSender.sh localshutdown &
    fi
    ;;
    *)
    echo " Usage: "
    echo " $0 start (start JReport Server)"
    echo " $0 stop (stop JReport 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