I have Raspberry Pi, I would like to play videos automatically while boot instead of clicking manually.So, I decided to do that by using crontab. I want to create a shell script for auto play. Please provide the shell script for starts to play videos automatically.


2 Answers 2


Seems like the answer to your question is contained within an other question on this site.

I am trying to play videos automatically when the Raspberry Pi boots. I decided to use crontab for that:

@reboot /storage/.config/autostart.sh

The autostart.sh file contains the following code:

xbmc-send -a "PlayMedia(/storage/videos/)"

The Raspberry Pi successfully automatically starts to play videos from /storage/videos/ directory when it reboots.

Hope that helps.


This is like asking "How do I fix my car when it won't start?" Your question is way to broad to answer. The process will remain basically the same form case to case. Here are some steps that you can go through to figure this out.

  2. Using Terminal, shell, SSH, etc., figure out the command that will start the video as desired.
  3. READ this document to figure out how to turn that shell command into a bash script. http://www.calpoly.edu/~rasplund/script.html
  4. READ this document to figure out how to run that bash script on boot http://www.cyberciti.biz/faq/linux-execute-cron-job-after-system-reboot/
  5. Reboot, test and troubleshoot.

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.