source: trunk/packs/maint/reactivate.sh @ 10907

Revision 10907, 3.7 KB checked in by ghudson, 27 years ago (diff)
Back out deletion of dotfiles in /tmp, since we wind up deleting sockets and things, and it doesn't even work for the Solaris sh. Of course, not deleting dotfiles in /tmp is sort of bogus; we should probably just have a per-platform exclusion list and delete everything using find or some such.
Line 
1#!/bin/sh
2# Script to bounce the packs on an Athena workstation
3#
4# $Id: reactivate.sh,v 1.35 1997-12-15 07:27:37 ghudson Exp $
5
6trap "" 1 15
7
8PATH=/bin:/bin/athena:/usr/ucb:/usr/bin; export PATH
9HOSTTYPE=`/bin/athena/machtype`; export HOSTTYPE
10
11umask 22
12. /etc/athena/rc.conf
13
14# Set various flags (based on environment and command-line)
15if [ "$1" = -detach ]; then
16        dflags=""
17else
18        dflags="-clean"
19fi
20
21if [ "$1" = -prelogin ]; then
22        if [ "$PUBLIC" = "false" ]; then
23                exit 0;
24        fi
25        echo "Cleaning up..." >> /dev/console
26        full=false
27else
28        full=true
29fi
30
31if [ -z "$USER" ]; then
32        exec 1>/dev/console 2>&1
33        quiet=-q
34else
35        echo "Reactivating workstation..."
36        quiet=""
37fi
38
39# Flush all NFS uid mappings
40/bin/athena/fsid $quiet -p -a
41
42# Tell the Zephyr hostmanager to reset state
43if [ -f /var/athena/zhm.pid -a "$ZCLIENT" = true ] ; then
44        /bin/kill -HUP `/bin/cat /var/athena/zhm.pid`
45fi
46
47# kdestroy from /tmp any ticket files that may have escaped other methods
48# of destruction, before we clear /tmp.
49for i in /tmp/tkt* /tmp/krb5cc*; do
50        KRBTKFILE=$i /usr/athena/bin/kdestroy -f
51done
52
53if [ "$full" = true ]; then
54        # Clean temporary areas (including temporary home directories)
55        case "$HOSTTYPE" in
56        sun4)
57                cp -p /tmp/ps_data /var/athena/ps_data
58                rm -rf /tmp/* > /dev/null 2>&1
59                cp -p /var/athena/ps_data /tmp/ps_data
60                rm -f /var/athena/ps_data
61                ;;
62        *)
63                rm -rf /tmp/* > /dev/null 2>&1
64                ;;
65        esac
66        rm -rf /var/athena/tmphomedir/* > /dev/null 2>&1
67fi
68
69# Copy in latest password file
70if [ "$PUBLIC" = true ]; then
71        if [ -r /srvd/etc/passwd ]; then
72                cp -p /srvd/etc/passwd /etc/passwd.local
73                chmod 644 /etc/passwd.local
74                chown root /etc/passwd.local
75        fi
76        if [ -r /srvd/etc/shadow ]; then
77                cp -p /srvd/etc/shadow /etc/shadow.local
78                chmod 600 /etc/shadow.local
79                chown root /etc/shadow.local
80        fi
81fi
82
83# Restore password and group files
84if [ -f /etc/passwd.local ] ; then
85        cp -p /etc/passwd.local /etc/ptmp && /bin/mv -f /etc/ptmp /etc/passwd
86fi
87if [ -f /etc/shadow.local ] ; then
88        cp -p /etc/shadow.local /etc/stmp && /bin/mv -f /etc/stmp /etc/shadow
89fi
90if [ -f /etc/group.local ] ; then
91        cp -p /etc/group.local /etc/gtmp && /bin/mv -f /etc/gtmp /etc/group
92fi
93
94if [ "$full" = true ]; then
95        # Reconfigure AFS state
96        if [ "$AFSCLIENT" != "false" ]; then
97                /etc/athena/config_afs > /dev/null 2>&1 &
98        fi
99fi
100
101# Punt any processes owned by users not in /etc/passwd.
102/etc/athena/cleanup -passwd
103
104if [ "$full" = true ]; then
105        # Remove session files.
106        for i in /var/athena/sessions/*; do
107                # Sanity check.
108                if [ -s $i ]; then
109                        logger -p user.notice "Non-empty session record $i"
110                fi
111                rm -f $i
112        end
113
114        # Detach all remote filesystems
115        /bin/athena/detach -O -h -n $quiet $dflags -a
116
117        # Now start activate again
118        /etc/athena/save_cluster_info
119
120        if [ -f /var/athena/clusterinfo.bsh ] ; then
121                . /var/athena/clusterinfo.bsh
122        elif [ "$RVDCLIENT" = true ]; then
123                echo "Can't determine system packs location."
124                exit 1
125        fi
126
127        if [ "$RVDCLIENT" = true ]; then
128                /bin/athena/attach      $quiet -h -n -o hard -O $SYSLIB
129        fi
130
131        # Perform an update if appropriate
132        /srvd/auto_update reactivate
133
134        if [ "$PUBLIC" = true -a -f /srvd/.rvdinfo ]; then
135                NEWVERS=`awk '{a=$5} END{print a}' /srvd/.rvdinfo`
136                THISVERS=`awk '{a=$5} END{print a}' /etc/athena/version`
137                if [ "$NEWVERS" = "$THISVERS" ]; then
138                        /usr/athena/etc/track
139                        cf=`cat /srvd/usr/athena/lib/update/configfiles`
140                        for i in $cf; do
141                                if [ -f /srvd$i ]; then
142                                        cp -p /srvd$i $i
143                                else
144                                        cp -p /os$i $i
145                                fi
146                        done
147                        ps -e | awk '$4=="inetd" {print $1}' | xargs kill -HUP
148                fi
149                rm -f /etc/athena/reactivate.local
150        fi
151fi
152
153if [ -f /usr/athena/bin/access_off ]; then
154        /usr/athena/bin/access_off
155fi
156
157if [ "$full" = true ]; then
158        if [ -f /etc/athena/reactivate.local ]; then
159                /etc/athena/reactivate.local
160        fi
161fi
162
163exit 0
Note: See TracBrowser for help on using the repository browser.