summaryrefslogtreecommitdiff
path: root/testscripts/Meego/dlt-daemon.cmake
blob: 8db30eb7e85b83b9a423c6ad585e670d6b64388f (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/sh

#######
# SPDX license identifier: MPL-2.0
#
# Copyright (C) 2011-2015, BMW AG
#
# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
#
# This Source Code Form is subject to the terms of the
# Mozilla Public License (MPL), v. 2.0.
# If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# For further information see http://www.genivi.org/.
#######

# Starts the DLT Daemon
#
# chkconfig: 2345 21 87
# description: Provides DLT Debug Logging & Trace functionality
# processname: dlt-daemon

# Source function library.
. /etc/rc.d/init.d/functions


processname=dlt-daemon
processpath=@CMAKE_INSTALL_PREFIX@/bin
servicename=dlt-daemon


[ -x $processpath ] || exit 0

start() {
    echo -n $"Starting $processname daemon: "
    @CMAKE_INSTALL_PREFIX@/bin/dlt-daemon -d
}

stop() {
    echo -n $"Stopping $processname daemon: "
    killproc $servicename -TERM
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$servicename
}

RETVAL=0

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    condrestart)
        if [ -f /var/lock/subsys/$servicename ]; then
            stop
            start
        fi
        ;;
    reload)
        restart
        ;;
    status)
        status $processname
        pidofdlt=`pidof $processname`
        if [ $pidofdlt ]
		 then
		   echo "DLT Deamon is running with PID:$pidofdlt"
		 else
		  echo "DLT Daemon is NOT running"
		fi

		if [ -f /var/log/messages ]
		 then
		echo "------- messages  ----------------"
		cat /var/log/messages | grep -a DLT | tail
		fi

		if [ -f /var/log/syslog ]
		 then
		 echo "------- SYSLOG -------------------"
		 cat /var/log/syslog | grep -a DLT | tail
		fi
    RETVAL=$?
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
        ;;
esac

exit $RETVAL