Schedule It
Scheduling a Python script to run at set intervals is most frequently done on Unix-based operating systems like the Raspberry Pi OS as a command run on (UNIX scheduler) or CRON job, for short. Recall that we previously set up a cron job to mount the Rclone-configured GoogleDrive folder mount point at boot up.
By default, cron jobs are run by the system and not the user who added the job to the scheduler. Since we added all the Python library dependencies for this project under the pi user account, we need to make sure that the system runs the script as the pi user with the appropriate file paths to the libraries that pip installed. Create a new file in the project directory, called runpispeak.sh that will be the shell script that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access