-
Notifications
You must be signed in to change notification settings - Fork 5
/
fdr
58 lines (50 loc) · 1.13 KB
/
fdr
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
#!/bin/sh
#
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Licensed under the Universal Permissive License v 1.0 as shown at
# https://oss.oracle.com/licenses/upl.
# Source function library.
. /etc/rc.d/init.d/functions
uid=`id | cut -d\( -f1 | cut -d= -f2`
case "$1" in
start)
[ -x /usr/sbin/fdrd ] || exit 5
# Only root can start the service
[ $uid -ne 0 ] && exit 4
# check to see if tracefs is mounted and where
tpath=`grep tracefs /etc/mtab | awk '{ print $2 }'`
[ -z "$tpath" ] && mount -t tracefs nodev /sys/kernel/tracing
tpath=`grep tracefs /etc/mtab | awk '{ print $2 }'`
[ -z "$tpath" ] && exit 5
action $"Starting fdr services "
daemon fdrd -d $tpath 2> /var/log/fdr.log
RETVAL=$?
echo
;;
stop)
# Only root can stop the service
[ $uid -ne 0 ] && exit 4
# Stop daemons.
echo -n $"Shutting down fdr daemon: "
killproc fdrd -15
RETVAL=$?
echo
;;
status)
status fdrd
RETVAL=$?
;;
restart )
$0 stop
$0 start
RETVAL=$?
echo
;;
*)
echo $"Usage: fdr {start|stop|status|restart}"
RETVAL=2
;;
esac
exit $RETVAL