Last active
January 1, 2021 19:33
-
-
Save pschichtel/fa46d49024dfb24c22c7bd2ce11e5b06 to your computer and use it in GitHub Desktop.
Small script to control a screen using CEC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
device="${CEC_DEVICE:-0.0.0.0}" | |
command="${1?no command given}" | |
case "$command" in | |
on) | |
cec_command="on $device" | |
;; | |
off) | |
cec_command="standby $device" | |
;; | |
*) | |
echo "Unknown command $command!" 1>&2 | |
exit 1 | |
esac | |
echo "$cec_command" | cec-client -s -d 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Turn on at 08:00 on every workday and turn off at 19:00 on every workday | |
0 8 * * 1-5 control_screen on >/dev/null 2>&1 | |
0 19 * * 1-5 control_screen off >/dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@nucleare nope, sorry. I haven't looked into this much beyond my use-case of turning the screen on and off using a cronjob.