]> git.pld-linux.org Git - packages/c-icap.git/blame - c-icap.init
- use pidfile for killproc and status
[packages/c-icap.git] / c-icap.init
CommitLineData
ec957391 1#!/bin/sh
2#
3# c-icap This shell script takes care of starting and stopping
4# c-icap ICAP server
5#
6# chkconfig: 345 90 10
7#
8# description: c-icap ICAP server
9#
10# processname: c-icap
63c223b9 11# pidfile: /var/run/c-icap/c-icap.pid
ec957391 12# config: /etc/c-icap/c-icap.conf
13
14# Source function library
15. /etc/rc.d/init.d/functions
16
17# Get network config
18. /etc/sysconfig/network
19
20# Get service config
21[ -f /etc/sysconfig/c-icap ] && . /etc/sysconfig/c-icap
22
63c223b9 23# Default pidfile location
24c_icap_pidfile="/var/run/c-icap/c-icap.pid"
25
ec957391 26# Check that networking is up.
27if is_yes "${NETWORKING}"; then
28 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
29 msg_network_down c-icap
30 exit 1
31 fi
32else
33 exit 0
34fi
35
36start() {
37 # Check if the service is already running?
38 if [ ! -f /var/lock/subsys/c-icap ]; then
39 msg_starting c-icap
40 daemon /usr/bin/c-icap
41 RETVAL=$?
42 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/c-icap
43 else
44 msg_already_running c-icap
45 fi
46}
47
48stop() {
49 if [ -f /var/lock/subsys/c-icap ]; then
50 # Stop daemons.
51 msg_stopping c-icap
63c223b9 52 killproc --pidfile $c_icap_pidfile c-icap
ec957391 53 rm -f /var/lock/subsys/c-icap >/dev/null 2>&1
54 else
55 msg_not_running c-icap
56 fi
57}
58
59restart() {
60 # if service is up, do configtest
61 if [ -f /var/lock/subsys/c-icap ]; then
62 if [ $RETVAL != 0 ]; then
63 exit 1
64 fi
65 fi
66 stop
67 start
68}
69
70condrestart() {
71 # if service is up, do configtest
72 if [ -f /var/lock/subsys/c-icap ]; then
73 if [ $RETVAL != 0 ]; then
74 exit 1
75 fi
76 stop
77 start
78 else
79 msg_not_running c-icap
80 RETVAL=0
81 fi
82}
83
84RETVAL=0
85# See how we were called.
86case "$1" in
87 start)
88 start
89 ;;
90 stop)
91 stop
92 ;;
93 restart)
94 restart
95 ;;
96 try-restart)
97 condrestart
98 ;;
99 reload|force-reload)
100 reload
101 ;;
102 status)
63c223b9 103 status --pidfile $c_icap_pidfile c-icap
ec957391 104 exit $?
105 ;;
106 *)
107 msg_usage "$0 {start|stop|init|restart|try-restart|reload|force-reload|status}"
108 exit 3
109esac
110
111exit $RETVAL
This page took 0.096822 seconds and 4 git commands to generate.