Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > dda4440faf74a89d6dfbe727734958e4 > files > 5

atop-1.23-3mdv2010.0.i586.rpm

#!/bin/sh
#
# atop		This shell script takes care of initializing atop
#
# chkconfig: 2345 85 15
# description:	Atop is a system and process activity monitor
#

# Check existance of binaries 
[ -f /usr/bin/atop ] || exit 0

PIDFILE=/var/run/atop.pid
RETVAL=0

# See how we were called.
case "$1" in
  start)
	# Check if atop runs already
	#
	if [ -e $PIDFILE ] && ps -p `cat $PIDFILE` | grep 'atop$' > /dev/null
	then
		:
	else
		# Start atop
		/etc/atop/atop.daily
	fi
	;;

  stop)
	# Check if atop runs
	#
	if [ -e $PIDFILE ] && ps -p `cat $PIDFILE` | grep 'atop$' > /dev/null
	then
		kill -USR1 `cat $PIDFILE` 	# take final sample
		sleep 3
		kill -TERM `cat $PIDFILE`
		rm $PIDFILE
		sleep 1
	fi
	;;

  status)
	;;

  reload)
	/etc/atop/atop.daily
	;;

  restart)
	/etc/atop/atop.daily
	;;

  *)
	echo "Usage: $0 [start|stop|status|reload|restart]"
	exit 1
esac

exit $RETVAL