Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
systemctl service - RPiCamWebInterface Annotation %a
[Unit]
Description=RPiWebCamInterface user annotation service
[Service]
Type=oneshot
ExecStart=/bin/bash /home/pi/piCamWebInterface-annotateService.sh
# scp /home/user/documents/scripts/raspberry/etc/systemd/system/piinfo.* pizerocam1:/tmp
# scp /home/user/documents/scripts/raspberry/home/pi/piinfo.sh pizerocam1:/home/pi
#
# ssh pizerocam1
# sudo su
# chmod 644 /tmp/piinfo.*
# mv /tmp/piinfo.* /lib/systemd/system/
# ls -s /lib/systemd/system/piinfo.* /etc/systemd/system/
# systemctl daemon-reload
# systemctl start piinfo.timer
# systemctl enable piinfo.timer
# nano /var/www/html/uconfig
#...add %a
#...ie: annotation %Y-%M-%D--%h-%m-%s %a
# exit # sudo su
# exit ssh
[Unit]
Description=RPiWebCamInterface user annotation timer
[Timer]
OnUnitActiveSec=1s
OnBootSec=1s
[Install]
WantedBy=timers.target
#!/bin/bash
[[ -z $(which bc) ]] && sudo apt install bc
# for use with RPiWebCamInterface %a
# /home/user/documents/scripts/raspberry/etc/systemd/system/piinfo.service
# /home/user/documents/scripts/raspberry/etc/systemd/system/piinfo.timer
t=$(( $(cat /sys/class/thermal/thermal_zone0/temp)/1000 ))
# f=$(( $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)/1000 ))
f=$( echo "scale=1;$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)/1000000"|bc|sed -E 's/^\./0\./')
[[ "$EUID" -eq 0 ]] && echo -ne "$HOSTNAME ${t}C ${f}GHz\\n " >/dev/shm/mjpeg/user_annotate.txt
echo "$HOSTNAME ${t}C ${f}GHz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment