Update to use the recommended recovery procedure from nvi-1.76.
This is a lot more robust and handles errors a lot better. It also cleans up stray, hopeless, or unmodified files rather than leaving them there forever.
This commit is contained in:
parent
ce5636f791
commit
4579c4e0d4
41
etc/rc
41
etc/rc
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# $Id: rc,v 1.102 1996/10/21 20:09:30 wpaul Exp $
|
||||
# $Id: rc,v 1.103 1996/10/28 08:28:02 joerg Exp $
|
||||
# From: @(#)rc 5.27 (Berkeley) 6/5/91
|
||||
|
||||
# System startup script run by init on autoboot
|
||||
@ -341,12 +341,43 @@ if [ -f /etc/rc.${arch} ]; then
|
||||
fi
|
||||
|
||||
# Recover vi editor files.
|
||||
virecovery=`echo /var/tmp/vi.recover/recover.*`
|
||||
if [ "$virecovery" != '/var/tmp/vi.recover/recover.*' ]; then
|
||||
vibackup=`echo /var/tmp/vi.recover/vi.*`
|
||||
if [ "$vibackup" != '/var/tmp/vi.recover/vi.*' ]; then
|
||||
echo 'Recovering vi editor sessions'
|
||||
for i in $virecovery; do
|
||||
sendmail -t < $i
|
||||
for i in $vibackup; do
|
||||
# Only test files that are readable.
|
||||
if test ! -r $i; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Unmodified nvi editor backup files either have the
|
||||
# execute bit set or are zero length. Delete them.
|
||||
if test -x $i -o ! -s $i; then
|
||||
rm -f $i
|
||||
fi
|
||||
done
|
||||
|
||||
# It is possible to get incomplete recovery files, if the editor
|
||||
# crashes at the right time.
|
||||
virecovery=`echo /var/tmp/vi.recover/recover.*`
|
||||
if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
|
||||
for i in $virecovery; do
|
||||
# Only test files that are readable.
|
||||
if test ! -r $i; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Delete any recovery files that are zero length,
|
||||
# corrupted, or that have no corresponding backup file.
|
||||
# Else send mail to the user.
|
||||
recfile=`awk '/^X-vi-recover-path:/{print $2}' < $i`
|
||||
if test -n "$recfile" -a -s "$recfile"; then
|
||||
sendmail -t < $i
|
||||
else
|
||||
rm -f $i
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# for each valid dir in $local_startup, search for init scripts matching *.sh
|
||||
|
Loading…
x
Reference in New Issue
Block a user