wok view linux-zram/stuff/compcache @ rev 19159
/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu May 26 20:16:45 2016 +0300 (2016-05-26) |
parents | 6a53523bda6d |
children | 2ba7edb00cce |
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 DESC="$(_ '%s daemon' compcache)"
11 EXIST=$(cat /proc/swaps | grep zram0)
13 case "$1" in
14 start)
15 if [ -n "$EXIST" ] ; then
16 _ '%s is already running.' $NAME
17 exit 1
18 fi
19 action 'Loading module...'
20 modprobe zram zram_num_devices=1 &&
21 [ -n "$SIZE_KB" ] && echo $(($SIZE_KB * 1024)) > /sys/block/zram0/disksize
22 status
24 action 'Starting %s: %s...' "$DESC" $NAME
25 mkswap /dev/zram0 && swapon /dev/zram0 -p 100
26 status
27 ;;
28 stop)
29 if [ -z "$EXIST" ] ; then
30 _ '%s is not running.' $NAME
31 exit 1
32 fi
33 action 'Stopping %s: %s...' "$DESC" $NAME
34 swapoff /dev/zram0 && echo 1 > /sys/block/zram0/reset
35 status
36 action 'Unloading module...'
37 rmmod zram
38 status
39 ;;
40 *)
41 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop]"
42 newline
43 exit 1
44 ;;
45 esac
47 exit 0