Skip to content

How to use run.sh

Claude Pageau edited this page May 4, 2024 · 10 revisions

Introduction

run.sh uses supervisorctl service to start, stop, status, Etc speed-cam.py and webserver.py per the configuration files in the supervisor folder. This will run the programs as background tasks under the specified user. These processes will be auto start on boot and/or attempt a restart if there is a program issue. Eg temporary communication timeout with a RTSP camera stream.

How to setup

1 Check crontab jobs for any speed-cam.py and/or webserver.py entries and disable as required.

sudo crontab -l
sudo crontab -e

2 Check /etc/rc.local for any speed-cam.py and/or webserver.py entries and comment out as required

3 Check for any existing running speed-cam.py and/or webserver.py processed and stop and/or kill. Easiest way is to run menubox.sh and select top menu picks and stop speed-cam.py and webserver.py if running

4 Install supervisor service symlinks

NOTE: If you have a non default speed-camera install eg not in /home/pi/speed-camera running under pi user then edit the appropriate conf file settings in the supervisor folder per.

nano ~/speed-camera/supervisor/speed-cam.conf
nano ~/speed-camera/supervisor/speed-web.conf

Modify the user= and/or directory= entries as required. Initialize the supervisorctl service for speed-cam.py and webserver.py per

./run.sh install

This will create symbolic links from the ~/speed-camera/supervisor folder files to /etc/supervisor/conf.d folder.

5 Reboot

6 The run.sh bash script manages supervisorctl processes for speed-cam.py and webserver.py per the appropriate conf files in the supervisor folder.

For run.sh help run

./run.sh help
./run.sh ver 2.0  written by Claude Pageau
Control speed-cam.py webserver.py

Usage: ./run.sh [Option]

Options:
  start        Start supervisor service
  stop         Stop supervisor service
  status       Status of supervisor service
  install      Install symbolic links for supervisor service
  uninstall    Uninstall symbolic links for supervisor service
  upgrade      Upgrade files from Github Repo
  help         Display Usage message and Status

Example:  ./run.sh status

Example: Manually Start supervisor background services for speed-cam.py and webserver.py per

./run.sh stop
./run.sh start
./run.sh status
./run.sh stop

Default location for log files is in /var/log. To view log files see examples below.

tail /var/log/speed-cam.log
cat /var/log/speed-cam.log
more /var/log/speed-cam.log

tail /var/log/speed-web.log