Skip to content

Instantly share code, notes, and snippets.

@pschichtel
Last active January 1, 2021 19:33
Show Gist options
  • Save pschichtel/fa46d49024dfb24c22c7bd2ce11e5b06 to your computer and use it in GitHub Desktop.
Save pschichtel/fa46d49024dfb24c22c7bd2ce11e5b06 to your computer and use it in GitHub Desktop.
Small script to control a screen using CEC
#!/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
# 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
@pschichtel
Copy link
Author

@nucleare nope, sorry. I haven't looked into this much beyond my use-case of turning the screen on and off using a cronjob.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment