Skip to content

Docu for power shellcmd is wrong #596

Description

@johann-pfefferl

The documentation for the shellcmd power control method is wrong. The return code for a successful operation for on/off is stated there as 1. But in my setup the correct return code is 0.

The following script works for me as expected. Take a look at the return codes.

#! /bin/sh

OFF=/var/cache/off
ON=/var/cache/on

PRIO='--tag PWRCTL --priority daemon.notice'

case "$1" in
        on)
                rm -f $OFF
                : > $ON
                logger $PRIO ON
                exit 0
                ;;
        off)
                rm -f $ON
                : > $OFF
                logger $PRIO OFF
                exit 0
                ;;
        check-on)
                logger $PRIO CHECK-ON
                test -f $ON && exit 0
                test -f $OFF && exit 1
                exit 3
                ;;
        *)
                exit 3
                ;;
esac

I intergated this script in my mtda config as following

[power]
variant=shellcmd
on-cmd=/usr/local/sbin/mtda-pwrctl.sh on
off-cmd=/usr/local/sbin/mtda-pwrctl.sh off
check-on=/usr/local/sbin/mtda-pwrctl.sh check-on

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions