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
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]
24 # Copyright (c) 1998-2001 by Sun Microsystems, Inc.
25 # All rights reserved.
27 #ident "%Z%%M% %I% %E% SMI"
29 # Default location for script
30 ncalogd
=/etc
/init.d
/ncalogd
33 # Default config values used by script
34 ncalogdconf
=/etc
/nca
/ncalogd.conf
35 ncakmodconf
=/etc
/nca
/ncakmod.conf
38 # Check if file exists
41 # Create subdirectories
42 logd_dir
=`/usr/bin/dirname $1`
43 if [ ! -d "$logd_dir" ]; then
44 /usr
/bin
/mkdir
-m 0755 -p $logd_dir > /dev
/null
2>&1
46 echo "Error: $ncalogd: unable to" \
47 "create directory $logd_dir"
54 echo "Error: ${ncalogd}: unable to create file $1"
59 # test if valid local file
60 df
-l $1 > /dev
/null
2>&1
62 echo "Error: $ncalogd: $1 is not a local file system"
69 # Check if device is valid
70 fsck
-m $1 > /dev
/null
2>&1
76 echo "Error: $ncalogd: refusing to overwrite filesystem on $1"
80 echo "Error: $ncalogd: $1 is an invalid device"
88 if [ ! -f $ncalogdconf ]; then
89 # If configuration file is missing, just exit
95 # Default is "disabled" so we want to exit
96 [ "x$status" != "xenabled" ] && exit 0
100 # Default is "disabled" so we want to exit
101 [ "x$status" != "xenabled" ] && exit 0
103 for i
in $logd_path_name; do
104 # make sure that specified logfile is not a directory
106 echo "Error: $ncalogd: $i is a directory"
108 elif [ -b $i -o -c $i ]; then
109 # Check if file is a device
110 isValidDev
$i ||
continue
112 isValidFile
$i ||
continue
115 # Finally, set the specified file as a NCA log file
116 /usr
/sbin
/ndd
-set /dev
/nca nca_log_file
$i
120 if [ $success = 0 ]; then
121 [ "x$logd_file_size" != "x" ] && \
122 /usr
/sbin
/ndd
-set /dev
/nca nca_log_size
$logd_file_size
123 /usr
/sbin
/ndd
-set /dev
/nca nca_logging_on
1
130 if [ "x$status" = "xenabled" ]; then
131 /usr
/sbin
/ndd
-set /dev
/nca nca_logging_on
0
136 echo "Usage: $0 { start | stop }"