Start Python Script with Crontab
~1 minute read
This is one way to launch a Python script on Linux machine at startup.
When I used cncjs with my laser engraver, I had to start it manually at each startup which can be annoying. I also added a script for the streaming of the camera.
The keyword that needs to be used is “@reboot“. Then, each time your computer starts, it will also launch the script.
# m h dom mon dow command
@reboot cncjs --allow-remote-access >> $HOME/cncjs.log 2>&1
@reboot sudo /home/pi/venv/bin/python /home/pi/streaming.py >> $HOME/streaming.log 2>&1