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