]> git.pld-linux.org Git - packages/distcache.git/blob - dc_client.init
- shared sysconfig for dc_client and dc_server
[packages/distcache.git] / dc_client.init
1 #!/bin/bash
2 #
3 # distcache    Startup script for the Distcache SSL Session Cache Client Proxy
4 #
5 # chkconfig:    345 88 12
6 # description:  Distcache is a Distributed SSL Session Cache Client Proxy.
7 # processname:  dc_client
8 # config:               /etc/sysconfig/distcache
9 # pidfile:              /var/run/dc_client.pid
10 #
11 # $Id$
12
13 # Source function library.
14 . /etc/rc.d/init.d/functions
15
16 # Get network config
17 . /etc/sysconfig/network
18
19 # Check that networking is up.
20 if is_yes "${NETWORKING}"; then
21         if [ ! -f /var/lock/subsys/network ]; then
22                 msg_network_down dc_client
23                 exit 1
24         fi
25 else
26         exit 0
27 fi
28
29 # Get service config
30 if [ -f /etc/sysconfig/distcache ]; then
31         . /etc/sysconfig/distcache
32 fi
33
34 port=${PORT-5555}
35 socket=${SOCKET-/var/cache/mod_ssl/distcache}
36 server=${SERVER-localhost}:${port}
37 owner=${OWNER-http}
38
39 runas=nobody
40 dc_client=/usr/bin/dc_client
41 pidfile=/var/run/dc_client.pid
42
43 OPTIONS="-daemon -pidfile ${pidfile} -listen UNIX:${socket} \
44         -sockowner ${owner} -sockperms 0600 -user ${runas} -server IP:${server}"
45
46 # See how we were called.
47 case "$1" in
48 start)
49         # Check if the service is already running?
50         if [ ! -f /var/lock/subsys/dc_client ]; then
51                 msg_starting dc_client
52                 daemon $dc_client $OPTIONS
53                 RETVAL=$?
54                 [ $RETVAL = 0 ] && touch /var/lock/subsys/dc_client
55         else
56                 msg_already_running dc_client
57         fi
58         ;;
59 stop)
60         if [ -f /var/lock/subsys/dc_client ]; then
61                 # Stop daemons.
62                 msg_stopping dc_client
63                 killproc $dc_client
64                 rm -f /var/lock/subsys/dc_client /var/run/dc_client.pid
65         else
66                 msg_not_running dc_client
67         fi
68         ;;
69 status)
70         status $dc_client
71         RETVAL=$?
72         ;;
73 restart|reload|force-reload)
74         $0 stop
75         $0 start
76         ;;
77 *)
78         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
79         exit 3
80 esac
81
82 exit $RETVAL
83
84 # This must be last line !
85 # vi:syntax=sh:tw=78:ts=4:sw=4
This page took 0.089808 seconds and 3 git commands to generate.