8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / bnu / uudemon.admin
blob304f213940d176f634c785a51736f46e9651e90d
1 #!/usr/bin/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 1997 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 #ident "%Z%%M% %I% %E% SMI"
29 # This shell sends uucp status information to an administrator.
30 # It should be started by a line in /var/spool/cron/crontabs/uucp.
31 # e.g.
33 # 48 8,12,16 * * * /etc/uucp/uudemon.admin
36 # return a list of systems defined in /etc/uucp/Systems
37 getsystems() {
38 if [ ! -f /etc/uucp/Systems ]; then
39 return
40 else
41 awk '$1 !~ /^#/ {print $1}' /etc/uucp/Systems
45 # return a list of systems defined in /etc/asppp.cf
46 getpppsystems() {
47 if [ ! -f /etc/asppp.cf ]; then
48 return
49 else
50 X=`sed -e 's/#.*$//' /etc/asppp.cf`
51 set -- $X
52 while [ $# -ne 0 ];
54 if [ "$1" = "peer_system_name" ]; then
55 PPPSYSTEMS="$PPPSYSTEMS $2"
57 shift
58 done
59 echo "$PPPSYSTEMS"
63 nouucp()
65 # run through the systems list, deleting ppp systems
66 outstr=""
67 for i in `getsystems`
69 del=0
70 for j in `getpppsystems`
72 if [ "$j" = "$i" ]; then
73 del=1
75 done
76 if [ $del -ne 1 ]; then
77 outstr="$outstr $i"
79 done
81 # if any names are in $outstr, assume uucp is configured
83 if [ -n "$outstr" ]; then
84 return 1
85 else
86 return 0
90 # Start of actual processing. For energystar compatibility,
91 # we attempt to do as little I/O as possible, so first check
92 # to see if uucp is configured before doing all this work.
94 if nouucp; then
95 exit 0
98 set +e
100 export PATH
101 PATH=/usr/bin
102 MAILTO=uucp
103 LOGDIR=/var/uucp/.Log
104 ULOG=$LOGDIR/uucico
105 TMP=/tmp/uu$$
107 (uustat -p; uustat -q) > $TMP
108 if [ -s $TMP ]
109 then
110 (echo "Subject: uu-status"; echo; cat $TMP) | mail $MAILTO
112 grep passwd $ULOG/* > $TMP 2> /dev/null
113 if [ -s $TMP ]
114 then
115 (echo "Subject: passwd check"; echo; cat $TMP) | mail $MAILTO
117 rm $TMP