dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sa / svc-sar
blob996a19ed9a1398d7897c1e56298ae1aa49424108
1 #!/sbin/sh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
8 # with the License.
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
21 # CDDL HEADER END
24 # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
28 # All Rights Reserved
30 #ident "%Z%%M% %I% %E% SMI"
32 # Start method script for the system activity reporting service.
34 # To enable periodic collection of data, you may need to uncomment
35 # the entries in /var/spool/cron/crontabs/sys
37 arg=$1
39 set -- `/usr/bin/who -r`
40 _INIT_RUN_NPREV="$8"
41 # utmpx's runlevel entries are only set on reaching single-user,
42 # so there might not be a who -r entry yet.
43 [ -z "$_INIT_RUN_NPREV" ] && _INIT_RUN_NPREV=0
45 case "$arg" in
46 'start')
47 if [ $_INIT_RUN_NPREV -eq 0 ]; then
49 /usr/lib/sa/sadc /var/adm/sa/sa`date +%d`
51 if [ ! -f /var/spool/cron/crontabs/sys ]; then
52 cat << EOF > /var/spool/cron/crontabs/sys
54 # sys crontab
56 # The sys crontab should be used to do performance collection.
57 # Please note that if the system/sar service is disabled this file
58 # will be deleted. Please keep a backup copy if you change the
59 # defaults.
61 0 * * * 0-6 /usr/lib/sa/sa1
62 20,40 8-17 * * 1-5 /usr/lib/sa/sa1
63 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
64 EOF
68 'stop')
69 rm /var/spool/cron/crontabs/sys
72 echo "Usage: $0 { start | stop }"
73 exit 1
75 esac
77 exit 0