Debian Codegraph @

testscripts/Meego/dlt-daemon.cmake

raw
1 #!/bin/sh
2
3 #######
4 # SPDX license identifier: MPL-2.0
5 #
6 # Copyright (C) 2011-2015, BMW AG
7 #
8 # This file is part of COVESA Project DLT - Diagnostic Log and Trace.
9 #
10 # This Source Code Form is subject to the terms of the
11 # Mozilla Public License (MPL), v. 2.0.
12 # If a copy of the MPL was not distributed with this file,
13 # You can obtain one at http://mozilla.org/MPL/2.0/.
14 #
15 # For further information see http://www.covesa.org/.
16 #######
17
18 # Starts the DLT Daemon
19 #
20 # chkconfig: 2345 21 87
21 # description: Provides DLT Debug Logging & Trace functionality
22 # processname: dlt-daemon
23
24 # Source function library.
25 . /etc/rc.d/init.d/functions
26
27
28 processname=dlt-daemon
29 processpath=@CMAKE_INSTALL_PREFIX@/bin
30 servicename=dlt-daemon
31
32
33 [ -x $processpath ] || exit 0
34
35 start() {
36 echo -n $"Starting $processname daemon: "
37 @CMAKE_INSTALL_PREFIX@/bin/dlt-daemon -d
38 }
39
40 stop() {
41 echo -n $"Stopping $processname daemon: "
42 killproc $servicename -TERM
43 RETVAL=$?
44 echo
45 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$servicename
46 }
47
48 RETVAL=0
49
50 case "$1" in
51 start)
52 start
53 ;;
54 stop)
55 stop
56 ;;
57 restart)
58 stop
59 start
60 ;;
61 condrestart)
62 if [ -f /var/lock/subsys/$servicename ]; then
63 stop
64 start
65 fi
66 ;;
67 reload)
68 restart
69 ;;
70 status)
71 status $processname
72 pidofdlt=`pidof $processname`
73 if [ $pidofdlt ]
74 then
75 echo "DLT Deamon is running with PID:$pidofdlt"
76 else
77 echo "DLT Daemon is NOT running"
78 fi
79
80 if [ -f /var/log/messages ]
81 then
82 echo "------- messages ----------------"
83 cat /var/log/messages | grep -a DLT | tail
84 fi
85
86 if [ -f /var/log/syslog ]
87 then
88 echo "------- SYSLOG -------------------"
89 cat /var/log/syslog | grep -a DLT | tail
90 fi
91 RETVAL=$?
92 ;;
93 *)
94 echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
95 ;;
96 esac
97
98 exit $RETVAL