Q:

How to run code using crontab on raspberry pi

I have to run code on the boot of raspberrypi. I am doing using this by below command
@reboot while true; do timeout 600 python3 TestProgram.py; sleep 4; done &

My program is not running. Please suggest me some corrections. Thanks in advance.

A:

There is some codes on this link. 
https://www.raspberrypi.org/documentation/linux/usage/cron.md
@reboot python /home/pi/myscript.py

You need to save your python file in the folder '/home/pi/'

