https://github.com/cesiumcz/webcam-snapshot
Shell script-based routine that takes unique snapshots from live JPEG images published on the Web.
https://github.com/cesiumcz/webcam-snapshot
timelapse webcam-capture
Last synced: about 2 months ago
JSON representation
Shell script-based routine that takes unique snapshots from live JPEG images published on the Web.
- Host: GitHub
- URL: https://github.com/cesiumcz/webcam-snapshot
- Owner: cesiumcz
- License: bsd-3-clause
- Created: 2024-02-10T22:02:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-10T22:56:28.000Z (over 1 year ago)
- Last Synced: 2025-03-02T20:28:25.624Z (7 months ago)
- Topics: timelapse, webcam-capture
- Language: Shell
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cesium webcam snapshot
Shell script-based routine that takes unique snapshots from live JPEG images published on the Web.## Prerequisities
- Shell - `bash` or Korn shell `ksh` (OpenBSD's default shell)
- `curl`## Installation
### System useruseradd -c "Webcam routine" -b /var/webcam/ -d /var/webcam-snapshot/ -s /sbin/nologin _webcam
install -d -m 770 -o root -g _webcam /var/webcam-snapshot/### Clone & file copy
cd /tmp/
git clone https://github.com/cesiumcz/webcam-snapshot.gitDetermine correct version `bash`/`ksh`:
mv snap.(bash|ksh) snap.sh
Install the script and set correct permissions
install -d -m 755 -o root -g _webcam /usr/local/webcam-snapshot/
install -m 754 -o root -g _webcam snap.sh /usr/local/webcam-snapshot/
rm -rf /tmp/webcam-snapshot/### Configuration
#### Camera listvim /usr/local/webcam-snapshot/cameras.txt
For each webcam, insert a line according to the following syntax:
cam_name jpg_uri
- *cam_name* = unique string camera name. Use short and simple names.
- *jpg_uri* = URI to JPEG imageA line starting with `#` is ignored.
Example contents of `cameras.txt`
pec https://www.chmi.cz/files/portal/docs/meteo/kam/pecpodsnezkou.jpg
jizerka https://www.chmi.cz/files/portal/docs/meteo/kam/jizerka.jpgSet proper permissions (`cameras.txt` is likely to contain credentials)
chown -R root:_webcam /usr/local/webcam-snapshot/
chmod 660 /usr/local/webcam-snapshot/cameras.txt### Cron
Invoke the script every minute between 6 to 18 hours:crontab -e -u _webcam
* 6-18 * * * /usr/local/webcam-snapshot/snap.sh## Testing
su -l _webcam /usr/local/webcam-snapshot/snap.sh
Or alternative using `doas` command:
doas -u _webcam /usr/local/webcam-snapshot/snap.sh
## Modus operandi
**`snap.sh`** does the following sequentially for each webcam:
- downloads current image into temporary location, if succeeds:
- checks if the new image differs from the last downloaded, if so:
- moves the second oldest image into final location### Directory structure
/tmp/webcam-snapshot/
|-- cam1
| `-- 202401201023.jpg
`-- cam2
`-- 202401201023.jpg/var/webcam-snapshot/
|-- cam1
| |-- 202401201020.jpg
| `-- 202401201010.jpg
`-- cam2
|-- 202401201020.jpg
`-- 202401201010.jpg## Author
[Matyáš Vohralík](https://mv.cesium.cz), 2024## License
[BSD 3-Clause](LICENSE)