Skip to content

Commit

Permalink
Add REFRESHRATE support
Browse files Browse the repository at this point in the history
  • Loading branch information
kx1t authored Dec 16, 2023
1 parent ceec13b commit b39aee3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion rootfs/scripts/update-plugins
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ then
for file in /tmp/AIS-catcher/plugins/*
do
file="${file##*/}"
if [[ -f /data/plugins/${file} ]] && ! diff "${file}" "/data/plugins/${file}" >/dev/null 2>&1
if [[ f /data/plugins/${file} ]] && ! diff "${file}" "/data/plugins/${file}" >/dev/null 2>&1
then
# Copy plugin file if it's newer but leave a backup in place
cp --backup=numbered -u "/tmp/AIS-catcher/plugins/${file}" "/data/plugins/${file}"
Expand All @@ -76,6 +76,17 @@ else
cp -n /tmp/AIS-catcher/plugins/* /data/plugins/ >/dev/null 2>&1
fi

# update or create the refreshrate.pjs plugin if needed
if [[ -n "${REFRESHRATE}" ]]; then
if [[ -f /data/plugins/refreshrate.pjs ]]; then
sed -i "s/^\s*#*\s*refreshIntervalMs.*\$/refreshIntervalMs = $REFRESHRATE/Ig" /data/plugins/refreshrate.pjs
else
echo "refreshIntervalMs = $REFRESHRATE/Ig" > /data/plugins/refreshrate.pjs
fi
else
rm -f /data/plugins/refreshrate.pjs
fi

# remove any plugin backups older than BACKUP_RETENTION_TIME (or 30 days if undefined)
find /data/plugins -name '*.~*~' -mtime +"${BACKUP_RETENTION_TIME:-30}" -exec rm {} \;

Expand Down

0 comments on commit b39aee3

Please sign in to comment.