#!/bin/ksh -p # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # BASEDIR=/etc/nwam/ulp/punchin-wlan WHO=/usr/bin/who AWK=/usr/bin/nawk # change this to your own user name USER=xxx # needed for X11 authentication export HOME=/export/home/$USER cd $BASEDIR/root for i in `find . -type f`; do dir=`dirname $i` find $BASEDIR/backups -type f -exec /bin/rm {} \; mkdir -p $BASEDIR/backups/$dir cp -p /$i $BASEDIR/backups/$i cp -p $i /$i done # wait until our used has logged into the console count=0 while :; do # Gnome users may need "| grep console" in the pipe chain below whoout=`$WHO | $AWK '{printf "%s %s %s\n", $1, $2, $NF}'` if [ "$whoout" = "$USER console (:0)" ]; then break fi sleep 1 ((count = $count + 1)) if [ $count -ge 300 ]; then exit 1 fi done /usr/local/bin/punchctl -x exit 0