Control: tag -1 + patch

On Wed, 13 May 2020 14:04:47 +0000, Rob J. Epping wrote:

> Debian allows for other init systems as well, please provide startup
> scripts for these too.
> 
> Looking at the script /usr/sbin/zramswap, a quick solution could be to
> move this script to /ets/init.d

It's not as simple as that, because /usr/sbin/zramswap has no
runlevel information.

Anyway, here's a simple init script (attached).

Cheers,
gregor

-- 
 .''`.  https://info.comodo.priv.at -- Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
   `-   NP: Tracy Chapman: Cold Feet
#!/usr/bin/env /lib/init/init-d-script

### BEGIN INIT INFO
# Provides:          zramswap
# Required-Start:    $syslog $time $remote_fs
# Required-Stop:     $syslog $time $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Linux zramswap setup
# Description:       Debian init script for zramswap
### END INIT INFO

DAEMON=/usr/sbin/zramswap
PIDFILE=none

_is_active() {
        $DAEMON status >/dev/null 2>&1
        return $?
}

do_start_prepare() {
        if _is_active; then
                log_warning_msg "$NAME is already active"
                exit 3
        fi
}

do_start_cmd_override() {
        $DAEMON start
}

do_stop_prepare() {
        if ! _is_active; then
                log_warning_msg "$NAME is not active"
                exit 3
        fi
}

do_stop_cmd_override() {
        $DAEMON stop
}

do_status_override() {
        $DAEMON status
}

do_restart_override() {
        if _is_active; then
                $DAEMON restart
        else
                $DAEMON start
        fi
}

Attachment: signature.asc
Description: Digital Signature

Reply via email to