SOURCES: preload.init (NEW) - based on template.init and one from ...
glen
glen at pld-linux.org
Sun Oct 23 02:25:52 CEST 2005
Author: glen Date: Sun Oct 23 00:25:51 2005 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- based on template.init and one from sources
---- Files affected:
SOURCES:
preload.init (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/preload.init
diff -u /dev/null SOURCES/preload.init:1.1
--- /dev/null Sun Oct 23 02:25:51 2005
+++ SOURCES/preload.init Sun Oct 23 02:25:46 2005
@@ -0,0 +1,80 @@
+#!/bin/sh
+#
+# preload Starts the preload daemon
+#
+# chkconfig: 345 05 95
+# description: Adaptive readahead daemon
+# processname: preload
+#
+# $Id$
+
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/preload ] && . /etc/sysconfig/preload
+
+MIN_MEMORY=${MIN_MEMORY:-256}
+# Check for > MIN_MEMORY MB
+free -m | awk '/Mem:/ {exit ($2 >= ('"$MIN_MEMORY"'))?0:1}' || exit 0
+
+# See how we were called.
+case "$1" in
+ start)
+ # Check if the service is already running?
+ if [ ! -f /var/lock/subsys/preload ]; then
+ msg_starting preload
+ daemon /usr/sbin/preload $PRELOAD_OPTS
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/preload
+ else
+ msg_already_running preload
+ fi
+ ;;
+ stop)
+ if [ -f /var/lock/subsys/preload ]; then
+ # Stop daemons.
+ msg_stopping preload
+ killproc /usr/sbin/preload
+ rm -f /var/lock/subsys/preload
+ else
+ msg_not_running preload
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit $?
+ ;;
+ reload)
+ if [ -f /var/lock/subsys/preload ]; then
+ msg_reloading preload
+ killproc preload -HUP
+ RETVAL=$?
+ else
+ msg_not_running preload >&2
+ RETVAL=7
+ fi
+ ;;
+ force-reload)
+ # if program allows reloading without stopping
+ $0 reload
+ exit $?
+ ;;
+ status)
+ status preload
+ RETVAL=$?
+ ;;
+ *)
+ msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+ exit 3
+esac
+
+exit $RETVAL
+
+# This must be last line !
+# vi:syntax=sh:tw=78:ts=4:sw=4
================================================================
More information about the pld-cvs-commit
mailing list