JIRA: COMPASS-66
Change-Id: I0a22f9f1b78d4dc96a452e8528eb95c026360503
Signed-off-by: chenshuai@huawei.com <chenshuai@huawei.com>
--- /dev/null
+#!/bin/bash
+# chkconfig: 345 98 2
+# description: ODL controller
+# OpenDaylight service controller script
+export JAVA_HOME=/usr/lib/jvm/java-8-oracle
+USER=odl
+
+cd /opt/opendaylight-0.3.0
+case "$1" in
+ start)
+ /bin/su -m $USER -s /bin/bash -c ./bin/start
+ ;;
+ stop)
+ /bin/su -m $USER -s /bin/bash -c ./bin/stop
+ ;;
+ status)
+ PID=`ps aux | grep java | grep karaf | awk '{print $2}'`
+ if test -z $PID
+ then
+ echo "ODL is down..."
+ exit 1
+ else
+ echo "ODL is running... PID $PID"
+ exit 0
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|status}"
+ exit 1
+ ;;
+esac
+++ /dev/null
-[Unit]
-Description=OpenDaylight SDN Controller
-Documentation=https://wiki.opendaylight.org/view/Main_Page http://www.opendaylight.org/
-After=network.service
-
-[Service]
-Type=forking
-ExecStart=/opt/opendaylight-0.3.0/bin/start
-User=odl
-Group=odl
-
-[Install]
-WantedBy=multi-user.target
service_file:
- src: opendaylight.service
- dst: /usr/lib/systemd/system/opendaylight.service
+ src: opendaylight
+ dst: /etc/init.d/opendaylight