I'm building out a new project called Black Box Timelapse
(Instructable coming soon...).
My python script is called : bbt.py
and lives in a directory called bbt
that is in the root directory. You can substitute your own director/Python script name instead of using mine.
We will use the Linux crontab to run the Python script.
I've had trouble with crontab and directory management and my solution is to amke a shell script, which always navigates to the proper directory and will launch my bbt.py
Let's create the shell script!
I'm using ssh to access to Raspberry Pi. My IP address for the SD card for this is 10.0.1.68. Your IP address may be different — just change the address accordingly.
Open the Terminal window and on the command line, type:
If you are running directly hooked into the monitor, you can skip this step.
Will launch your editor, type in this script
# navigate to home directory, then to this directory, then execute python script, then back home
sudo python bbt.py
cd /Cntl-X, Return
What this script will do is to navigate to the root directory, then to the bbt directory, launch the Python script and then return to the root directory.