-
Notifications
You must be signed in to change notification settings - Fork 102
How to Run pi timolo on Boot
Auto start pi-timolo.py and/or webserver.py from /etc/rc.local
- Description
- How to Automate Boot Startup using rc.local
- Test Reboot
- How To Control Operation From crontab
- Manual Control
pi-timolo.sh is a bash script that runs pi-timolo.py as a background task after a short wait period. If the script is run a second time it will display the PID of the background task. pi-timolo.sh can be edited using nano to send verbose logging to a log file when running as a background task. See code comments for changing the default behavior. Default is no redirection of verbose logging. There is a 10 second wait in the script to allow time for startup services to complete before starting pi-timolo.py This can be increased if there is a problem.
IMPORTANT: Change the config.py variable verbose=False to supress console messages, otherwise messages will be sent to the foreground console session and may cause problems.
Make sure the files in pi-timolo are all owned by pi before running process in background as user pi. To change ownership execute the following command
sudo chown -R pi:pi /home/pi/pi-timolo/*
ls -Rl /home/pi/pi-timolo | more
To auto launch pi-timolo.py on boot-up of raspberry pi perform the following
sudo nano /etc/rc.local
In nano add the following command to the rc.local file just before the exit 0 command. This will launch pi-timolo and the webserver in the background running under the pi user (not root). Note the webserver startup is optional.
su pi -c "/home/pi/pi-timolo/pi-timolo.sh start"
su pi -c "/home/pi/pi-timolo/webserver.sh start"
ctrl-x y to save and exit nano editor
Reboot RPI and test operation by triggering motion and checking images are successfully saved to your motion or timelapse folder.
sudo reboot
Login and check if pi-timolo.sh and or webserver is running or verify they are running under pi user
pgrep -f pi-timolo.py # returns PID if running
ps -ef | grep python | grep -v grep # Full List all python tasks
or run menubox.sh to show status of pi-timolo.py and/or webserver.py
cd ~/pi-timolo ./menubox.sh
Sometimes you want to only run during specific days or time periods. You can setup crontab entries to perform simple or complex scheduling of pi-timolo tasks. The crontab @reboot commands below are an alternative to using /etc/rc.local It is recommended that you Do Not use Both methods but sometimes you want to control all settings using one method so controlling autostart from crontab can simplify admin.
Control start/stop operation from a crontab entry. Open crontab per command below.
sudo crontab -e
Then add these lines to the end of the file and press enter:
@reboot su pi -c "/home/pi/pi-timolo/pi-timolo.sh start"
@reboot su pi -c "/home/pi/pi-timolo/webserver.sh start"
To stop the pi-timolo and or webserver background task You can use menubox.sh or use command line.
cd ~/pi-timolo
./menubox.sh
or from terminal console
cd ~/pi-timolo
./pi-timolo.sh stop
./webserver.sh stop
Trouble shoot problems as required.
- Wiki Home
- Introduction
- Prerequisites
- Install or Upgrade
- Run pi-timolo from a drive mnt
- Customize config.py
- Panoramic Images
- user_motion_code.py
- Align Camera Motion Area
- Schedule StartAt
- Basic Troubleshooting
- Tuning Variable Settings
- menubox.sh
- Web Server View Files
- Make Timelapse Video
- Join or Convert h264 to MP4
- Run on Boot
- Setup & Run shutdown.py
- Rclone Media Sync
- watch-app.sh Usage
- Plugins Usage
- Mount USB Storage
- Mount Network Share
- Auto SubFolder Creation
- Manage Disk Space
- Utilities Summary
- GitHub Repo
gdrive is no longer default.