summaryrefslogtreecommitdiff
path: root/yocto_template/rvi.init
blob: 069d78a72208f10090c80aed2221b728966df912 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
#
# Copyright (C) 2014, Jaguar Land Rover
#
# This program is licensed under the terms and conditions of the
# Mozilla Public License, version 2.0.  The full text of the 
# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/
#
#
# Init.d script to start and stop an RVI system installed
# through an RPM.
#
### BEGIN INIT INFO
# Provides:          rvi
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: RVI Framework
### END INIT INFO


export PATH="/bin/:/usr/bin:/sbin:/usr/sbin"
. /etc/init.d/functions

set -e 

DAEMON_PATH="/opt/rvi_core"
DAEMON_NAME="rvi"

case "$1" in
  start)
        echo -n "Starting $DAEMON_NAME: "
        $DAEMON_PATH/rvi_ctl -c /etc/opt/rvi/rvi.config start
        RETVAL=$?
        if [ $RETVAL -eq 0 ] ; then
            echo "OK"
        else
            echo "FAIL"
        fi
        ;;

  stop)
        echo -n "Stopping $DAEMON_NAME: "
        $DAEMON_PATH/rvi_ctl stop
        RETVAL=$?
        if [ $RETVAL -eq 0 ] ; then
            echo "OK"
        else
            echo "FAIL"
        fi
        ;;

  restart)
        echo -n "Restarting $DAEMON_NAME: " 
        $DAEMON_PATH/rvi_ctl restart
        RETVAL=$?
        if [ $RETVAL -eq 0 ] ; then
            echo "OK"
        else
            echo "FAIL"
        fi
        ;;

    status)
        status $DAEMON_NAME
        RETVAL=$?
        ;;

  *)
	echo "usage: $0 { start | stop | status | restart | status }"
	;;
esac

exit $RETVAL