#!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # %apache2_htcacheclean_dname Startup script for the Apache cache cleaner # # chkconfig: - 85 15 # description: The Apache htcacheclean daemon maintains and prunes the # size of the mod_disk_cache cache directory. # processname: %apache2_htcacheclean_dname # pidfile: %apache2_htcacheclean_lockdir/%apache2_htcacheclean_dname.pid # config: %_sysconfdir/sysconfig/%apache2_htcacheclean_dname # ### BEGIN INIT INFO # Provides: %apache2_htcacheclean_dname # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Should-Start: %apache2_dname # Short-Description: start and stop Apache htcacheclean # Description: The Apache htcacheclean daemon maintains a mod_disk_cache ### END INIT INFO # Source function library. . %_sysconfdir/rc.d/init.d/functions # What were we called? Multiple instances of the same daemon can be # created by creating suitably named symlinks to this startup script prog=$(basename $0 | sed -e 's/^[SK][0-9][0-9]//') # edit %_sysconfdir/sysconfig/${prog} to change this HTCACHECLEAN_SIZE=300M HTCACHECLEAN_DAEMON_INTERVAL=120 HTCACHECLEAN_PATH=%apache2_htcacheclean_cachepath HTCACHECLEAN_OPTIONS="" if [ -f %_sysconfdir/sysconfig/${prog} ]; then . %_sysconfdir/sysconfig/${prog} fi # Path to htcacheclean, server binary, and short-form for messages. htcacheclean=${HTCACHECLEAN-%apache2_sbindir/%apache2_htcacheclean_dname} htcacheclean_start=${htcacheclean}-daemon-start lockfile=%apache2_htcacheclean_lockdir/${prog} pidfile=%apache2_htcacheclean_piddir/${prog}.pid interval=$HTCACHECLEAN_DAEMON_INTERVAL cachepath=$HTCACHECLEAN_PATH limit=$HTCACHECLEAN_SIZE httpduser=${HTTPDUSER-%apache2_user} OPTIONS=$HTCACHECLEAN_OPTIONS RETVAL=0 start() { start_daemon --pidfile "$pidfile" --lockfile "$lockfile" \ --user $httpduser --name $prog -- $htcacheclean_start \ -d "$interval" -p "$cachepath" -l "$limit" -P "$pidfile" $OPTIONS RETVAL=$? return $RETVAL } stop() { stop_daemon --pidfile "$pidfile" --lockfile "$lockfile" \ --name $prog -- $htcacheclean RETVAL=$? return $RETVAL } restart() { stop start } brieftatus() { status --pidfile "$pidfile" --lockfile "$lockfile" \ --name $prog -- $htcacheclean RETVAL=$? return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) brieftatus ;; restart) restart ;; condstop) if [ -e "$lockfile" ]; then stop fi ;; update|condrestart) if [ -e "$lockfile" ]; then restart fi ;; *) echo $"Usage: $prog {start|stop|restart|condstop|condrestart|status|help}" exit 1 esac exit $RETVAL