@@ -97,9 +97,6 @@ cameras:
97
97
fps: 5
98
98
EOF
99
99
ln -sf /config/config.yml /opt/frigate/config/config.yml
100
- mkdir -p /dev/shm/logs/{frigate,go2rtc,nginx}
101
- touch /dev/shm/logs/{frigate/current,go2rtc/current,nginx/current}
102
- chmod -R 777 /dev/shm
103
100
sed -i -e ' s/^kvm:x:104:$/render:x:104:root,frigate/' -e ' s/^render:x:105:root$/kvm:x:105:/' /etc/group
104
101
msg_ok " Installed Frigate $RELEASE "
105
102
@@ -145,10 +142,24 @@ sed -i 's/access_log \/dev\/stdout main\;/access_log nginx\.log main\;/' /usr/lo
145
142
msg_ok " Built Nginx"
146
143
147
144
msg_info " Creating Services"
145
+ cat << EOF >/etc/systemd/system/create_directories.service
146
+ [Unit]
147
+ Description=Create necessary directories for logs
148
+
149
+ [Service]
150
+ Type=oneshot
151
+ 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'
152
+
153
+ [Install]
154
+ WantedBy=multi-user.target
155
+ EOF
156
+ systemctl enable -q --now create_directories
157
+ sleep 3
148
158
cat << EOF >/etc/systemd/system/go2rtc.service
149
159
[Unit]
150
160
Description=go2rtc service
151
161
After=network.target
162
+ After=create_directories.service
152
163
StartLimitIntervalSec=0
153
164
154
165
[Service]
@@ -157,6 +168,8 @@ Restart=always
157
168
RestartSec=1
158
169
User=root
159
170
ExecStart=bash /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run
171
+ StandardOutput=file:/dev/shm/logs/go2rtc/current
172
+ StandardError=file:/dev/shm/logs/go2rtc/current
160
173
161
174
[Install]
162
175
WantedBy=multi-user.target
@@ -167,6 +180,7 @@ cat <<EOF >/etc/systemd/system/frigate.service
167
180
[Unit]
168
181
Description=Frigate service
169
182
After=go2rtc.service
183
+ After=create_directories.service
170
184
StartLimitIntervalSec=0
171
185
172
186
[Service]
@@ -175,6 +189,8 @@ Restart=always
175
189
RestartSec=1
176
190
User=root
177
191
ExecStart=bash /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run
192
+ StandardOutput=file:/dev/shm/logs/frigate/current
193
+ StandardError=file:/dev/shm/logs/frigate/current
178
194
179
195
[Install]
180
196
WantedBy=multi-user.target
@@ -185,6 +201,7 @@ cat <<EOF >/etc/systemd/system/nginx.service
185
201
[Unit]
186
202
Description=Nginx service
187
203
After=frigate.service
204
+ After=create_directories.service
188
205
StartLimitIntervalSec=0
189
206
190
207
[Service]
@@ -193,6 +210,8 @@ Restart=always
193
210
RestartSec=1
194
211
User=root
195
212
ExecStart=bash /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/nginx/run
213
+ StandardOutput=file:/dev/shm/logs/nginx/current
214
+ StandardError=file:/dev/shm/logs/nginx/current
196
215
197
216
[Install]
198
217
WantedBy=multi-user.target
0 commit comments