openhab2 Startup script raspberry pi version not working

Ok, here is a quick howto about init.d scripts:
click

But be aware that you need to register the service as described or the service dies when you close the console…
`

INIT INFO

# Provides: openhab2
# Required-Start: $localfs $syslog $remote_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: openhab2 daemon
# Description: openhab2 init.d script
### END INIT INFO

 # simple init for openhab2

 pidfile=/var/run/openhab2.pid

 case "$1" in
  start|"")
        chrt 50 /opt/openhab2/start.sh | perl -ne '$|=1; print localtime . ": [openhab2] $_"' >> /var/log/openhab2.log &
        ;;
  restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
  stop)
        killall openhab2
        ;;
  status)
        if [ ! -e $pidfile ]; then
                echo "No pid"
                exit 1
        fi
        pid=`cat $pidfile`
        if kill -0 $pid &>1 > /dev/null; then
                echo "Running"
                exit 0
        else
                rm $pidfile
                echo "Not running"
                exit 1
        fi

        ;;
  *)
        echo "Usage: openhab2 [start|stop|status]" >&2
        exit 3
        ;;
 esac

`