Home | Fedora Core 4 Tutorial | Linux Tutorials | Linux Games | Linux Java | Linux Kernal | Linux Firewall | Linux Database | Linux Distributions | Linux Firewall GUI | Linux Distributions | Linux Firewall

 


 

Search Host

Monthly Fee($)
Disk Space (MB)
Register With us for Newsletter!
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

Tutorials

Java Server Pages

JAXB

Java Beans

JDBC

MySQL

Java Servlets

Struts

Bioinformatics

Java Code Examples

Interview Questions

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Web Promotion

Web Submission

Submit Sites

Manual Submission?

Web Promotion Guide

Hosting Companies

Web Hosting Guide

Web Hosting

Linux

Beginner Guide to Linux Server

Linux Distribution

Major Linux Distribution

Linux FTP Software

Frameworks

Persistence Framework

Web Frameworks

Free EAI Tools

Web Servers

Aspect Oriented Programming

Free Proxy Servers

Softwares

Adware & Spyware Remover

Open Source Softwares

Next Previous Contents

9. The swapinit.sh script

This shell script initializes the swap space on the partition. The code for signature detection has been repeated 6 times because many a times the signature is properly detected only on the second or the third try.

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

 
#!/bin/sh 
# 
# swapinit.sh - activate the swap partition 
# 
# written by Rahul U. Joshi 
# Verify and initialize swap space 
# 
 
echo -n 'Verifying swap space... ' 
 
loopcount=0 
 
# flag to indicate whether the partition has been activated or not 
activated=0 
 
# check for signatures 6 times before giving up 
while [ $loopcount -lt 6 ] 
  do 
 
  if [ "`/bin/dd 2>/dev/null if=/dev/winswap bs=1 count=10  skip=4086`" = 'SWAP-SPACE' ]; then 
    echo "Linux signature found, iteration $loopcount" 
    echo "Activating swap partitions"  
    swapon /dev/winswap 
    activated=1 
    break 
 
  elif [ "`/bin/dd 2>/dev/null if=/dev/winswap bs=1 count=11 skip=43`" = 'SWAP SPACE ' ]; then    
    echo "DOS signature found, iteration $loopcount" 
    echo "Making swap partition"   
    mkswap /dev/winswap YYYYY 
    echo "Activating swap partitions"  
    swapon /dev/winswap 
    activated=1 
    break 
 
  else    
   let loopcount=loopcount+1 
  fi   
 
  done 
 
 
if [ $activated -ne 1 ] ; then 
  echo "Swap signature not found after $loopcount tries" 
  echo "No swapping partitions activated" 
  exit 1 
fi 

Next Previous Contents
Search Tutorials

Linux Distributions

Fedora

Slackware
SuSe
Mandrake
Knoppix
Mepis
Debian
All Distors....
 

 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2004. All rights reserved.