Benvenuto, Ospite
Nome utente: Password: Ricordami

ARGOMENTO: HDMI ON | OFF

HDMI ON | OFF 2 Anni 7 Mesi fa #121

Creare uno script avviabile con il seguente contenuto e gestirlo via crontab
#!/bin/bash -e

# /root/raspy-hdmi
# Script to enable and disable the HDMI signal of the Raspberry PI
# Inspiration: http://www.raspberrypi.org/forums/viewtopic.php?t=16472&p=176258

CMD="$1"

function on {
    /opt/vc/bin/tvservice --preferred

    # Hack to enable virtual terminal nr 7 again:
    chvt 6
    chvt 7
}

function off {
    /opt/vc/bin/tvservice --off
}

function must_be_root {
    if [ $USER != root ]; then
        echo "ERROR: Script must be executed as the root user"
        exit 1
    fi
}

function main {
    must_be_root
    if [ "$CMD" == "on" ]; then
        on
    elif [ "$CMD" == "off" ]; then
        off
    else
        echo "Usage: $0 <on|off>"
        exit 1
    fi
    exit 0
}

main
# Enable the monitor every weekday morning at 7:30
30 7 * * 1,2,3,4,5 /root/raspy-hdmi on > /dev/null 2>&1

# Disable the monitor every weekday evening at 18:30
30 18 * * 1,2,3,4,5 /root/raspy-hdmi off > /dev/null 2>&1
Ultima modifica: 2 Anni 7 Mesi fa da admin76.
L\'Amministratore ha disattivato l\'accesso in scrittura al pubblico.
Tempo creazione pagina: 0.141 secondi
Powered by Forum Kunena