From c9fe057500ae15626280cef4161f82b095468b1c Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Fri, 28 Apr 2006 19:29:16 +0000 Subject: [PATCH] - standard initscript for swapmon --- swapmon.init | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 swapmon.init diff --git a/swapmon.init b/swapmon.init new file mode 100755 index 0000000..d99530d --- /dev/null +++ b/swapmon.init @@ -0,0 +1,72 @@ +#!/bin/bash +# +# swapmon Swap monitoring daemon +# +# chkconfig: 2345 98 2 +# +# description: Resets memory hogs when swap is running low +# +# $Id: host.init,v 1.6 2006/04/20 09:01:00 thierry Exp $ +# + +PATH=/sbin:/bin:/usr/bin:/usr/sbin + +# Source function library. +. /etc/init.d/functions + +# Source configuration +if [ -f /etc/sysconfig/swapmon ] ; then + . /etc/sysconfig/swapmon +fi + +pidfile=/var/run/swapmon.pid +lockfile=/var/lock/subsys/swapmon +RETVAL=0 + +start () +{ + echo -n $"Starting swap monitor: " + daemon --check=swapmon /usr/share/pl_mom/swapmon.py $SWAPMON_OPTIONS + RETVAL=$? + echo + [ $RETVAL = 0 ] && touch ${lockfile} + return $RETVAL +} + +stop () +{ + echo -n $"Stopping swap monitor: " + killproc swapmon + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} +} + + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + stop + start + ;; + condrestart) + if [ -f ${lockfile} ] ; then + stop + start + fi + ;; + status) + status swapmon.py + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" + RETVAL=1 + ;; +esac + +exit $RETVAL -- 2.43.0