Skip to content

Commit

Permalink
Tweak systemd service to enable auto-restart
Browse files Browse the repository at this point in the history
  • Loading branch information
nvtkaszpir committed Jul 6, 2024
1 parent aa87db6 commit 30aca82
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 32 deletions.
45 changes: 15 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,23 @@

Linux shell script to send still camera images to Prusa Connect

See [docs here](https://nvtkaszpir.github.io/prusa-connect-camera-script)
## Documentation

## Quick start
See [docs here](https://nvtkaszpir.github.io/prusa-connect-camera-script) for:

RaspberryPi with CSI camera with libcamera:
* feature list
* requirements
* general step-by-step install
* example configs
* advanced tweaks

```shell
# go to Prusa Connect site, add camera, copy token, turn on your 3D printer

cp csi.dist .env
# edit .env file, set token and fingerprint
## Development

set -o allexport; source .env; set +o allexport
Those are generally notes to myself :)

./prusa-connect-camera.sh

```
### Docs

Any linux host with ffmpeg and RTSP camera:

```shell
# go to Prusa Connect site, add camera, copy token, turn on your 3D printer

cp ffmpeg-mediamtx-rtsp-tcp.dist .env
# edit .env file, set token and fingerprint
# change 'rtsp://raspberry-pi:8554/cam' to rtsp://<username>:<password>@<camera-ip-address>/<stream-name>

set -o allexport; source .env; set +o allexport

./prusa-connect-camera.sh

```

## Docs
Preview documentation locally

```shell
pip install -r requirements.txt
Expand All @@ -47,7 +30,9 @@ mkdocs serve

Auto-published by github action when pushed to master.

## Code commits
### Code commits

ensure to have [pre-commit](https://pre-commit.com/) installed.

```shell
npm install -g markdown-link-check
Expand All @@ -58,7 +43,7 @@ git add .
pre-commit run --all
```

## Docker container build
### Docker container build

```shell
make quay
Expand Down
5 changes: 5 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Things to check if it does not work.

## General

- some USB cameras require physical unplung/plug-in AFTER
the Rasberry Pi was turned on, there is no fix for this yet, see
[raspberrypi/linux/issues/6255](https://github.com/raspberrypi/linux/issues/6255)
for such example

- check `/dev/shm/camera_*.stdout` and `/dev/shm/camera_*.stderr`
files for more details - if they still that 'everything is okay'
then probably you have issues with permissions when running script
Expand Down
7 changes: 5 additions & 2 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[Unit]
Description=Prusa Connect Camera Script
After=network.target
After=network.target systemd-udev-trigger.service
Wants=network.target
Requires=systemd-udev-trigger.service

[Service]
User=pi
Group=pi
EnvironmentFile=/home/pi/src/prusa-connect-camera-script/.%i
ExecStart=/home/pi/src/prusa-connect-camera-script/prusa-connect-camera.sh
Restart=on-failure
Restart=always
RestartSec=15

[Install]
WantedBy=multi-user.target

0 comments on commit 30aca82

Please sign in to comment.