Files
Arquivotheca.Solaris-2.5/cmd/initpkg/init.d/rumounts
seta75D 7c4988eac0 Init
2021-10-11 19:38:01 -03:00

56 lines
1008 B
Plaintext
Executable File

#ident "@(#)rumounts 1.6 92/07/14 SMI" /* SVr4.0 1.4.3.2 */
# Unmounts all remote file resources with warning period.
# Note: written to depend on as few commands as possible.
WALL=/tmp/wall$$
trap '/usr/bin/rm -f ${WALL}' 0 1 2 3 15
grace=60 # grace period
while [ $# -ge 1 ]
do
case "$1" in
-g )
shift
grace=$1
;;
stop) # executed by an rc? script
grace=0 # warning was sent by shutdown
;;
* )
echo >&2 "Usage: $0 [{ -g <seconds> | stop }]"
exit 1
;;
esac
shift
done
echo "the following resources will be removed from the system\
in ${grace} seconds: " >${WALL}
/sbin/mount |
/usr/bin/sort -r |
{
sndmsg=0
while read fs dummy1 dev mode1 mode2 dummy2
do
if [ `echo ${mode1}${mode2} | /usr/bin/grep remote` ]
then
echo "\t${fs}" >>${WALL}
sndmsg=1
fi
done
exit ${sndmsg}
}
sndmsg=$?
if [ ${grace} -ne 0 -a ${sndmsg} -ne 0 ]
then
/usr/sbin/wall <${WALL}
/usr/bin/sleep ${grace}
fi
/usr/sbin/rumountall 2>/dev/null
/usr/sbin/rumountall -k