-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathldapgraph.rc.rhel
85 lines (70 loc) · 1.78 KB
/
ldapgraph.rc.rhel
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
#!/bin/sh
#
# chkconfig: 345 99 01
# description: Ldapgraph daemon
#
# File : ldapgraph
#
# Copyright (c) 2007 Esben Bach
#
# Author: Esben Bach <esben@ofn.dk>
# Untested so there are probably bugs errors
# /etc/init.d/ldapgraph
#
### BEGIN INIT INFO
# Provides: ldapgraph
# Required-Start: $net
# Required-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: Start the ldapgraph daemon
### END INIT INFO
LDAPGRAPH_BIN=/path/to/ldapgraph.pl
USER='ldap'
GROUP='ldap'
RUNDIR=/var/run/ldapgraph/
test -x $LDAPGRAPH_BIN || exit 5
# Shell functions sourced from /etc/rc.d/init.d/functions
. /etc/rc.d/init.d/functions
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting ldapgraph daemon: "
daemon $LDAPGRAPH_BIN --daemonized
;;
stop)
echo -n "Shutting down ldapgraph: "
killproc $LDAPGRAPH_BIN
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
$0 status >/dev/null && $0 restart
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
## Wait 2 Seconds to be nice
sleep 2
$0 start
;;
reload)
echo -n "Reload ldapgraph"
killproc $LDAPGRAPH_BIN -HUP
rc_status -v
;;
status)
echo -n "Checking for ldapgraph: "
status $LDAPGRAPH_BIN
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|reload}"
exit 1
esac
exit 0