Clone the repository inside the /home/pi/Downloads
folder using the following command:
git clone https://github.com/davegroff/raspberryPi-Webcam-System.git
-
Set Executable Permissions: Run the command below to set executable permissions for the startup script:
sudo chmod +x /home/pi/Downloads/raspberryPi-Webcam-System/startup.sh sudo chmod +x /home/pi/Downloads/raspberryPi-Webcam-System/program.sh
-
Create/Update the Systemd Service:
Open and edit the systemd service file by running:
sudo nano /etc/systemd/system/webcam.service
Paste the following content into the file:
[Unit] Description=RaspberryPi5 Webcam System After=network-online.target [Service] WorkingDirectory=/home/pi/Downloads/raspberryPi-Webcam-System ExecStart=/home/pi/Downloads/raspberryPi-Webcam-System/startup.sh User=pi Restart=always StandardOutput=syslog StandardError=syslog SyslogIdentifier=webcam_service [Install] WantedBy=multi-user.target
sudo nano /etc/systemd/system/chromium.service
Paste the following content into the file:
[Unit] Description=Launch Chromium with Pyppeteer After=network-online.target Requires=network-online.target [Service] WorkingDirectory=/home/pi/Downloads/raspberryPi-Webcam-System ExecStart=/home/pi/Downloads/raspberryPi-Webcam-System/program.sh User=pi Restart=always StandardOutput=syslog StandardError=syslog SyslogIdentifier=chromium_service [Install] WantedBy=multi-user.target
-
Reload Systemd Daemon and Manage the Service: Run the following commands to reload the systemd daemon, enable, start, and check the status of the service:
sudo systemctl daemon-reload sudo systemctl enable webcam.service sudo systemctl start webcam.service sudo systemctl status webcam.service sudo systemctl enable chromium.service sudo systemctl start chromium.service sudo systemctl status chromium.service
Open a web browser and go to localhost:9000
to serve the video stream from Raspberry Pi
To see the stream, launch browser and go to localhost:9000/stream
Follow these steps meticulously to ensure a seamless setup and management of the RaspberryPi Webcam System as a Systemd service on your Raspberry Pi device.
sudo systemctl stop webcam.service sudo systemctl stop chromium.service
sudo journalctl -u webcam.service -f sudo journalctl -u chromium.service -f
Note: remove -f flag and full logs shown forward/back using keyboard F and B.