File stopblktrace of Package preload
#! /bin/sh
#
# Copyright (c) 2007 SuSE Linux Products GmbH Nuernberg, Germany. All rights reserved.
#
### BEGIN INIT INFO
# Provides: stopblktrace
# Required-Start: $ALL boot.blktrace $remote_fs
# Required-Stop: $null
# Default-Start: 1 2 3 5
# Default-Stop:
# Description: Stopping and parsing the blktrace output
# Short-Description: Stop blktrace
### END INIT INFO
. /etc/rc.status
rc_reset
case "$1" in
start)
rm -f /var/run/lastblks
pid=$(pidof blktrace)
if test -n "$pid"; then
echo "Stopping blktrace..."
kill $pid
blkparse -i /dev/shm/blktrace.out | \
cut -b45- | sed -e "s, RM , R ," | grep " R " | \
sed -e "s, *R \([0-9]*\) + \([0-9]\).*,\1+\2," | grep '^[0-9+]*$' > /var/run/lastblks
rm /dev/shm/blktrace*
fi
rc_status -v -r
;;
stop)
rc_status -v
;;
reload)
rc_failed 3
rc_status -v
;;
status)
rc_failed 4
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
;;
esac
rc_exit