Git init
[pkgs/e/elektra.git] / scripts / kdbd
1 #!/bin/bash
2 #
3 # kdbd:   Starts the Elektra Key Database Daemon
4 #
5 # chkconfig: 12345 00 99
6 # description:  This is the overall daemon needed to correctly access Elektra
7 #               key databases on backends like BerkeleyDB.
8 #               The daemon will use the backend pointed
9 #               by /lib/elektra/libelektra-ddefault.so.
10 #               Though not recomended, an elektrified program can access a
11 #               key database without this daemon. But different permissions
12 #               calculations will be performed.
13 # processname: /sbin/kdbd
14 # config: 
15 # config: 
16 #
17 ### BEGIN INIT INFO
18 # Provides: kdbd
19 # Required-Start: 
20 # Default-Stop: 0 6
21 # Short-Description: Starts the Elektra Key Database access daemon
22 # Description:  This is the overall daemon needed to correctly access Elektra
23 #               key databases on backends like BerkeleyDB.
24 #               The daemon will use the backend pointed
25 #               by /lib/elektra/libelektra-ddefault.so.
26 #               Though not recomended, an elektrified program can access a
27 #               key database without this daemon. But different permissions
28 #               calculations will be performed.
29 ### END INIT INFO
30 #
31 # $Id$
32 #
33 #
34
35
36 KDBD_PATH=/sbin
37 RETVAL=0
38 prog=kdbd
39 pidfile=/var/run/kdbd/$prog.pid
40
41 # Sanity checks.
42 #[ -f /etc/nscd.conf ] || exit 0
43 [ -x $KDBD_PATH/kdbd ] || exit 0
44
45 # Source function library.
46 . /etc/init.d/functions
47
48 # Source an auxiliary options file if we have one, and pick up NSCD_OPTIONS.
49 #[ -r /etc/sysconfig/nscd ] && . /etc/sysconfig/nscd
50
51 start () {
52         [ -d /var/run/$prog ] || mkdir /var/run/$prog
53 #    [ -d /var/db/nscd ] || mkdir /var/db/nscd
54 #    secure=""
55         echo -n $"Starting $prog: "
56         daemon $KDBD_PATH/$prog     # $secure $KDBD_OPTIONS
57 #       daemon --check $prog $prog --pidfile=$pidfile
58         RETVAL=$?
59         echo
60         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/kdbd
61         return $RETVAL
62 }
63
64 stop () {
65         echo -n $"Stopping $prog: "
66         killproc $prog
67         echo
68         RETVAL=$?
69         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
70         return $RETVAL
71 }
72
73 restart() {
74         stop
75         start
76 }
77
78 # See how we were called.
79 case "$1" in
80         start)
81         start
82         RETVAL=$?
83         ;;
84         stop)
85         stop
86         RETVAL=$?
87         ;;
88     status)
89         status kdbd
90         RETVAL=$?
91         ;;
92         restart)
93         restart
94         RETVAL=$?
95         ;;
96         try-restart | condrestart)
97         [ -e /var/lock/subsys/$prog ] && restart
98         RETVAL=$?
99         ;;
100         force-reload | reload)
101         echo -n $"Reloading $prog: "
102         killproc /usr/sbin/$prog -HUP
103         RETVAL=$?
104         echo
105         ;;
106         *)
107         echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
108         RETVAL=1
109         ;;
110 esac
111 exit $RETVAL