Group :: Sistema/Configurações/Hadware
RPM: zram-swap
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
#!/bin/sh
# zram-swap: Configure and activate /dev/zram0 as swap device
#
# chkconfig: 2345 08 92
# description: Configure and activate /dev/zram0 as swap device
# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1
# Source function library.
. /etc/init.d/functions
. /etc/sysconfig/zram-swap
start()
{
RETVAL=1
SWAPON="swapon /dev/$ZDEV"
modprobe zram
[ -b "/dev/ZDEV" ] || sleep 1
if [ -n "$ZSIZE" ] && [ "$ZSIZE" -ge 1 ] && [ -n "$ZDEV" ] && [ -b "/dev/$ZDEV" ]; then
echo "$ZSIZE" > /sys/block/$ZDEV/disksize
mkswap /dev/$ZDEV
[ -n "$ZPRIORITY" ] && SWAPON="swapon -p $ZPRIORITY /dev/$ZDEV"
action "Activating swap on $ZDEV" $SWAPON
RETVAL=0
fi
return $RETVAL
}
stop()
{
action "Deactivate $ZRAM:" swapoff /dev/$ZDEV
echo 1 > /sys/block/$ZDEV/reset
RETVAL=$?
return $RETVAL
}
restart()
{
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
condreload|condrestart|condstop)
;;
*)
msg_usage "${0##*/} {start|stop|reload|restart|condreload|condrestart|condstop}"
RETVAL=1
esac
exit $RETVAL