Skip to content

Commit

Permalink
Update frigate-install.sh
Browse files Browse the repository at this point in the history
Fix logs
  • Loading branch information
tteck committed Apr 1, 2024
1 parent 8ee2219 commit 6dcc29a
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions install/frigate-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ cameras:
fps: 5
EOF
ln -sf /config/config.yml /opt/frigate/config/config.yml
mkdir -p /dev/shm/logs/{frigate,go2rtc,nginx}
touch /dev/shm/logs/{frigate/current,go2rtc/current,nginx/current}
chmod -R 777 /dev/shm
sed -i -e 's/^kvm:x:104:$/render:x:104:root,frigate/' -e 's/^render:x:105:root$/kvm:x:105:/' /etc/group
msg_ok "Installed Frigate $RELEASE"

Expand Down Expand Up @@ -145,10 +142,24 @@ sed -i 's/access_log \/dev\/stdout main\;/access_log nginx\.log main\;/' /usr/lo
msg_ok "Built Nginx"

msg_info "Creating Services"
cat <<EOF >/etc/systemd/system/create_directories.service
[Unit]
Description=Create necessary directories for logs
[Service]
Type=oneshot
ExecStart=/bin/bash -c '/bin/mkdir -p /dev/shm/logs/{frigate,go2rtc,nginx} && /bin/touch /dev/shm/logs/{frigate/current,go2rtc/current,nginx/current} && /bin/chmod -R 777 /dev/shm/logs'
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now create_directories
sleep 3
cat <<EOF >/etc/systemd/system/go2rtc.service
[Unit]
Description=go2rtc service
After=network.target
After=create_directories.service
StartLimitIntervalSec=0
[Service]
Expand All @@ -157,6 +168,8 @@ Restart=always
RestartSec=1
User=root
ExecStart=bash /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run
StandardOutput=file:/dev/shm/logs/go2rtc/current
StandardError=file:/dev/shm/logs/go2rtc/current
[Install]
WantedBy=multi-user.target
Expand All @@ -167,6 +180,7 @@ cat <<EOF >/etc/systemd/system/frigate.service
[Unit]
Description=Frigate service
After=go2rtc.service
After=create_directories.service
StartLimitIntervalSec=0
[Service]
Expand All @@ -175,6 +189,8 @@ Restart=always
RestartSec=1
User=root
ExecStart=bash /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run
StandardOutput=file:/dev/shm/logs/frigate/current
StandardError=file:/dev/shm/logs/frigate/current
[Install]
WantedBy=multi-user.target
Expand All @@ -185,6 +201,7 @@ cat <<EOF >/etc/systemd/system/nginx.service
[Unit]
Description=Nginx service
After=frigate.service
After=create_directories.service
StartLimitIntervalSec=0
[Service]
Expand All @@ -193,6 +210,8 @@ Restart=always
RestartSec=1
User=root
ExecStart=bash /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/nginx/run
StandardOutput=file:/dev/shm/logs/nginx/current
StandardError=file:/dev/shm/logs/nginx/current
[Install]
WantedBy=multi-user.target
Expand Down

1 comment on commit 6dcc29a

@GrumpyMeow
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way to go!

Please sign in to comment.