forked from urbanserj/entente
-
Notifications
You must be signed in to change notification settings - Fork 1
/
lightldapd.init.d
executable file
·64 lines (57 loc) · 1.5 KB
/
lightldapd.init.d
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
#!/bin/sh
### BEGIN INIT INFO
# Provides: lightldapd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Simplest ldap server with authentication via pam
### END INIT INFO
# Author: Sergey Urbanovich <[email protected]>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="ldap server"
NAME=lightldapd
DAEMON=/usr/sbin/$NAME
DAEMON_OPTS="-d -l"
SCRIPTNAME=/etc/init.d/$NAME
ENABLED=1
# Exit if the package is not installed.
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present.
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Exit if the package is not enabled.
[ "$ENABLED" != "0" ] || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting $DESC" $NAME
if ! start-stop-daemon --start --oknodo --quiet \
--exec $DAEMON -- $DAEMON_OPTS
then
log_end_msg 1
else
log_end_msg 0
fi
;;
stop)
log_daemon_msg "Stopping $DESC" $NAME
if start-stop-daemon --stop --retry 2 --oknodo --quiet \
--exec $DAEMON
then
log_end_msg 0
else
log_end_msg 1
fi
;;
restart|force-reload)
$0 stop
$0 start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac