write transient files to tmpfs aka ram drive

This commit is contained in:
frederik
2024-02-11 17:19:09 +01:00
parent 35db8bcb3b
commit a4122b5bcc
4 changed files with 29 additions and 1 deletions
+19
View File
@@ -26,3 +26,22 @@ get_tf_whl () {
}
fi
}
install_birdnet_mount() {
TMP_MOUNT=$(systemd-escape -p --suffix=mount "$RECS_DIR/StreamData")
cat << EOF > $HOME/BirdNET-Pi/templates/$TMP_MOUNT
[Unit]
Description=Birdnet tmpfs for transient files
ConditionPathExists=$RECS_DIR/StreamData
[Mount]
What=tmpfs
Where=$RECS_DIR/StreamData
Type=tmpfs
Options=mode=1777,nosuid,nodev
[Install]
WantedBy=multi-user.target
EOF
ln -sf $HOME/BirdNET-Pi/templates/$TMP_MOUNT /usr/lib/systemd/system
}
+2
View File
@@ -413,6 +413,7 @@ install_services() {
install_gotty_logs
install_phpsysinfo
install_livestream_service
install_birdnet_mount
install_cleanup_cron
install_weekly_cron
increase_caddy_timeout
@@ -426,6 +427,7 @@ install_services() {
if [ -f ${config_file} ];then
source ${config_file}
source install_helpers.sh
install_services
chown_things
else
+2 -1
View File
@@ -6,7 +6,8 @@ my_dir=$HOME/BirdNET-Pi/scripts
source /etc/birdnet/birdnet.conf &> /dev/null
SCRIPTS=($(ls -1 ${my_dir}) ${HOME}/.gotty)
set -x
services=($(awk '/service/ && /systemctl/ && !/php/ {print $3}' ${my_dir}/install_services.sh | sort) custom_recording.service avahi-alias@.service)
TMP_MOUNT=$(systemd-escape -p --suffix=mount "$RECS_DIR/StreamData")
services=($(awk '/service/ && /systemctl/ && !/php/ {print $3}' ${my_dir}/install_services.sh | sort) custom_recording.service avahi-alias@.service $TMP_MOUNT)
remove_services() {
for i in "${services[@]}"; do
+6
View File
@@ -106,6 +106,12 @@ if grep -q 'birdnet_server.service' "$HOME/BirdNET-Pi/templates/birdnet_analysis
systemctl daemon-reload && restart_services.sh
fi
TMP_MOUNT=$(systemd-escape -p --suffix=mount "$RECS_DIR/StreamData")
if ! [ -f "$HOME/BirdNET-Pi/templates/$TMP_MOUNT" ]; then
install_birdnet_mount
chown $USER:$USER "$HOME/BirdNET-Pi/templates/$TMP_MOUNT"
fi
if grep -q 'php7.4-' /etc/caddy/Caddyfile &>/dev/null; then
sed -i 's/php7.4-/php-/' /etc/caddy/Caddyfile
fi