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