wok-6.x view linux-zram/stuff/compcache @ rev 18343
Up: bash (4.3.42)
author | Alexander Medvedev <devl547@gmail.com> |
---|---|
date | Fri Sep 11 11:59:50 2015 +0000 (2015-09-11) |
parents | 7d3f6d7f2528 |
children | 7f188676b59c |
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 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 "Unloading module"
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