]> git.pld-linux.org Git - packages/c-icap.git/commitdiff
- init script for c-icap
authorhawk <hawk@pld-linux.org>
Mon, 21 Mar 2011 09:56:02 +0000 (09:56 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    c-icap.init -> 1.1

c-icap.init [new file with mode: 0644]

diff --git a/c-icap.init b/c-icap.init
new file mode 100644 (file)
index 0000000..2b490d3
--- /dev/null
@@ -0,0 +1,108 @@
+#!/bin/sh
+#
+# c-icap       This shell script takes care of starting and stopping
+#              c-icap ICAP server
+#
+# chkconfig:   345 90 10
+#
+# description: c-icap ICAP server
+#
+# processname: c-icap
+# pidfile:     /var/run/c-icap.pid
+# config:      /etc/c-icap/c-icap.conf
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config
+[ -f /etc/sysconfig/c-icap ] && . /etc/sysconfig/c-icap
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
+               msg_network_down c-icap
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+start() {
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/c-icap ]; then
+               msg_starting c-icap
+               daemon /usr/bin/c-icap
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/c-icap
+       else
+               msg_already_running c-icap
+       fi
+}
+
+stop() {
+       if [ -f /var/lock/subsys/c-icap ]; then
+               # Stop daemons.
+               msg_stopping c-icap
+               killproc c-icap
+               rm -f /var/lock/subsys/c-icap >/dev/null 2>&1
+       else
+               msg_not_running c-icap
+       fi
+}
+
+restart() {
+       # if service is up, do configtest
+       if [ -f /var/lock/subsys/c-icap ]; then
+               if [ $RETVAL != 0 ]; then
+                       exit 1
+               fi
+       fi
+       stop
+       start
+}
+
+condrestart() {
+       # if service is up, do configtest
+       if [ -f /var/lock/subsys/c-icap ]; then
+               if [ $RETVAL != 0 ]; then
+                       exit 1
+               fi
+               stop
+               start
+       else
+               msg_not_running c-icap
+               RETVAL=0
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       restart
+       ;;
+  try-restart)
+       condrestart
+       ;;
+  reload|force-reload)
+       reload
+       ;;
+  status)
+       status c-icap
+       exit $?
+       ;;
+  *)
+       msg_usage "$0 {start|stop|init|restart|try-restart|reload|force-reload|status}"
+       exit 3
+esac
+
+exit $RETVAL
This page took 0.043142 seconds and 4 git commands to generate.