svc-sar revision 7c478bd95313f5f23a4c958a745db2134aa03244
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#!/sbin/sh
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# CDDL HEADER START
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# The contents of this file are subject to the terms of the
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# Common Development and Distribution License, Version 1.0 only
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# (the "License"). You may not use this file except in compliance
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# with the License.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# or http://www.opensolaris.org/os/licensing.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# See the License for the specific language governing permissions
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# and limitations under the License.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# When distributing Covered Code, include this CDDL HEADER in each
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# If applicable, add the following below this CDDL HEADER, with the
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# fields enclosed by brackets "[]" replaced with your own identifying
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# information: Portions Copyright [yyyy] [name of copyright owner]
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# CDDL HEADER END
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# Use is subject to license terms.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# All Rights Reserved
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#ident "%Z%%M% %I% %E% SMI"
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# Start method script for the system activity reporting service.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# To enable periodic collection of data, you may need to uncomment
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# the entries in /var/spool/cron/crontabs/sys
18c2aff776a775d34a4c9893a4c72e0434d68e36artem
18c2aff776a775d34a4c9893a4c72e0434d68e36artemarg=$1
18c2aff776a775d34a4c9893a4c72e0434d68e36artem
18c2aff776a775d34a4c9893a4c72e0434d68e36artemset -- `/usr/bin/who -r`
18c2aff776a775d34a4c9893a4c72e0434d68e36artem_INIT_RUN_NPREV="$8"
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# utmpx's runlevel entries are only set on reaching single-user,
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# so there might not be a who -r entry yet.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem[ -z "$_INIT_RUN_NPREV" ] && _INIT_RUN_NPREV=0
18c2aff776a775d34a4c9893a4c72e0434d68e36artem
18c2aff776a775d34a4c9893a4c72e0434d68e36artemcase "$arg" in
18c2aff776a775d34a4c9893a4c72e0434d68e36artem'start')
18c2aff776a775d34a4c9893a4c72e0434d68e36artem if [ $_INIT_RUN_NPREV -eq 0 ]; then
18c2aff776a775d34a4c9893a4c72e0434d68e36artem
18c2aff776a775d34a4c9893a4c72e0434d68e36artem /usr/lib/sa/sadc /var/adm/sa/sa`date +%d`
18c2aff776a775d34a4c9893a4c72e0434d68e36artem
18c2aff776a775d34a4c9893a4c72e0434d68e36artem if [ ! -f /var/spool/cron/crontabs/sys ]; then
18c2aff776a775d34a4c9893a4c72e0434d68e36artem cat << EOF > /var/spool/cron/crontabs/sys
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# sys crontab
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# The sys crontab should be used to do performance collection.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# Please note that if the system/sar service is disabled this file
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# will be deleted. Please keep a backup copy if you change the
18c2aff776a775d34a4c9893a4c72e0434d68e36artem# defaults.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#
18c2aff776a775d34a4c9893a4c72e0434d68e36artem0 * * * 0-6 /usr/lib/sa/sa1
18c2aff776a775d34a4c9893a4c72e0434d68e36artem20,40 8-17 * * 1-5 /usr/lib/sa/sa1
18c2aff776a775d34a4c9893a4c72e0434d68e36artem5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
18c2aff776a775d34a4c9893a4c72e0434d68e36artemEOF
18c2aff776a775d34a4c9893a4c72e0434d68e36artem fi
18c2aff776a775d34a4c9893a4c72e0434d68e36artem fi
18c2aff776a775d34a4c9893a4c72e0434d68e36artem ;;
18c2aff776a775d34a4c9893a4c72e0434d68e36artem'stop')
18c2aff776a775d34a4c9893a4c72e0434d68e36artem rm /var/spool/cron/crontabs/sys
18c2aff776a775d34a4c9893a4c72e0434d68e36artem ;;
18c2aff776a775d34a4c9893a4c72e0434d68e36artem*)
18c2aff776a775d34a4c9893a4c72e0434d68e36artem echo "Usage: $0 { start | stop }"
18c2aff776a775d34a4c9893a4c72e0434d68e36artem exit 1
18c2aff776a775d34a4c9893a4c72e0434d68e36artem ;;
esac
exit 0