wok-next annotate linux-zram/stuff/compcache @ rev 15237
memtest-serial: fix receipt name
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Sep 23 10:36:37 2013 +0000 (2013-09-23) |
parents | |
children | 6a53523bda6d |
rev | line source |
---|---|
pascal@13390 | 1 #!/bin/sh |
pascal@13390 | 2 # /etc/init.d/compcache: Start, stop and restart COMPCACHE daemon on SliTaz, |
pascal@13390 | 3 # at boot time or with the command line. Daemons options are configured |
pascal@13390 | 4 # with /etc/daemons.conf |
pascal@13390 | 5 # |
pascal@13390 | 6 . /etc/init.d/rc.functions |
pascal@13390 | 7 source /etc/compcache.conf |
pascal@13390 | 8 |
pascal@13390 | 9 NAME="compcache" |
pascal@13390 | 10 EXIST=`cat /proc/swaps | grep zram0` |
pascal@13390 | 11 |
pascal@13390 | 12 case "$1" in |
pascal@13390 | 13 start) |
pascal@13390 | 14 if [ ! "$EXIST" = "" ] ; then |
pascal@13390 | 15 echo "$NAME already running." |
pascal@13390 | 16 exit 1 |
pascal@13390 | 17 fi |
pascal@13390 | 18 echo -n "Loading module" |
pascal@13390 | 19 modprobe zram num_devices=1 && |
pascal@13390 | 20 [ -n "$SIZE_KB" ] && echo $(($SIZE_KB * 1024)) > /sys/block/zram0/disksize |
pascal@13390 | 21 status |
pascal@13390 | 22 |
pascal@13390 | 23 echo -n "Starting $NAME..." |
pascal@13390 | 24 mkswap /dev/zram0 && swapon /dev/zram0 -p 100 |
pascal@13390 | 25 status |
pascal@13390 | 26 ;; |
pascal@13390 | 27 stop) |
pascal@13390 | 28 if [ "$EXIST" = "" ] ; then |
pascal@13390 | 29 echo "$NAME is not running." |
pascal@13390 | 30 exit 1 |
pascal@13390 | 31 fi |
pascal@13390 | 32 echo -n "Stopping $NAME... " |
pascal@13390 | 33 swapoff /dev/zram0 && echo 1 > /sys/block/zram0/reset |
pascal@13390 | 34 status |
pascal@13390 | 35 echo -n "Unloding modules" |
pascal@13390 | 36 rmmod zram |
pascal@13390 | 37 status |
pascal@13390 | 38 ;; |
pascal@13390 | 39 *) |
pascal@13390 | 40 echo "" |
pascal@13390 | 41 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop]" |
pascal@13390 | 42 echo "" |
pascal@13390 | 43 exit 1 |
pascal@13390 | 44 ;; |
pascal@13390 | 45 esac |
pascal@13390 | 46 |
pascal@13390 | 47 exit 0 |