So when I run either of the following from the cli (SSH session) my pi will turn on my Samsung TV:

echo "as" | cec-client -s
echo "on 0" | cec-client -s

However when I but either of these into cron via crontab -e nothing happens. An example of what I have in the cron file is:

0 8 * * * echo "on 0" | cec-client -s

If i try add >> /home/pi/log to that line I get an empty file called log in my home directory.

How can I debug this? Or, can anyone tell me what I'm doing wrong?

1 Answer 1


It seems this is a path issue. Adding the full path to the cec-client binary solves the problem.


0 8 * * * echo "on 0" | /usr/local/bin/cec-client -s
  • That is by design cron doesn't run as your user so does not have the $PATH environment variable set. Oct 21, 2014 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.