The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

Next Previous Contents

10. The swaphalt.sh script

This script first checks the Linux swap signature and then restores the Windows file system on it.

(Adapted from the original Swap-Space-HOWTO by H. Peter Anvin)

 
#!/bin/sh 
# 
# swaphalt.sh   This file is executed through the /etc/rc.d/init.d/halt 
#               script after swapping and accounting has been turned off. 
# 
# Author:       Rahul U. Joshi 
# 
 
# check swap partition signature and restore Windows swap info 
 
loopcount=0 
 
# flag to indicate whether the swap info has been restored or not 
restored=0 
 
# check for swap signature 3 times before giving up 
while [ $loopcount -lt 3 ] 
  do 
 
  if [ "`/bin/dd 2>/dev/null if=/dev/winswap bs=1 count=10 skip=4086`" = 'SWAP-SPACE' ]; then 
    echo "Restoring DOS/Windows swap info , iteration $loopcount"  
    /bin/zcat /etc/winswap.gz  >  /dev/winswap 
    restored=1 
    break 
  else 
    loopcount=loopcount+1 
  fi 
 
  done 
 
if [ $restored -ne 1 ] ; then 
   echo "Swap signature not found after $loopcount tries" 
   echo "Skipping restoring" 
fi 
 

Next Previous Contents


Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру