Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > b611ea73723a8287cce23d3124a6eeea > files > 236

howto-sgml-ko-2006-5mdv2010.0.noarch.rpm

#!/bin/bash

# ½º¿Ò ÆÄÀÏ ¸¸µé±â.
# ·çÆ®·Î ½ÇÇà½ÃÅ°¼¼¿ä.

ROOT_UID=0         # ·çÆ® $UID ´Â 0.
E_WRONG_USER=65    # ·çÆ®°¡ ¾Æ´Ô.

FILE=/swap
BLOCKSIZE=1024
MINBLOCKS=40
SUCCESS=0

if [ "$UID" -ne "$ROOT_UID" ]
then
  echo; echo "ÀÌ ½ºÅ©¸³Æ®´Â ·çÆ®¸¸ ½ÇÇà½Ãų ¼ö ÀÖ½À´Ï´Ù."; echo
  exit $E_WRONG_USER
fi  
  

if [ -n "$1" ]
then
  blocks=$1
else
  blocks=$MINBLOCKS              # ¸í·É¾îÁÙ¿¡¼­ ÁöÁ¤ÇØ ÁÖÁö ¾ÊÀ¸¸é 
fi                               # 40 ºí·°À» ±âº»°ªÀ¸·Î ¼¼Æ®.

if [ "$blocks" -lt $MINBLOCKS ]
then
  blocks=$MINBLOCKS              # ÃÖ¼Ò 40 ºí·°À̾î¾ß µË´Ï´Ù.
fi  


echo "Creating swap file of size $blocks blocks (KB)."
dd if=/dev/zero of=$FILE bs=$BLOCKSIZE count=$blocks  # Zero out file.

mkswap $FILE $blocks             # Designate it a swap file.
swapon $FILE                     # Activate swap file.

echo "Swap file created and activated."

exit $SUCCESS