Tuesday, September 27, 2005

 

rc.swapfile

#!/bin/sh
# rc.swapfile This shell script takes care swapfile
#
# chkconfig: 2345 99 05
# description: mount a swapfile
# processname: rc.swapfile
# config: /swapfile

# karl@singlefin.net
# Last Update: Wed Aug 31 20:21:14 PDT 2005

DIR=/var

if [ -f $DIR/swapfile ]; then
echo "swapon $DIR/swapfile"
swapon -p 1 $DIR/swapfile
fi

if [ ! -f $DIR/swapfile ]; then
echo "creating swapfile. Please wait."
dd if=/dev/zero of=$DIR/swapfile bs=1M count=4096
sleep 2
chmod 0600 $DIR/swapfile
sleep 2
mkswap $DIR/swapfile
sleep 3
swapon -p 1 $DIR/swapfile
echo "...done, $DIR/swapfile now exists"
fi

exit 0


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?