Skip to content

Instantly share code, notes, and snippets.

@carpii
Created November 20, 2021 20:57
Show Gist options
  • Save carpii/5fbdf15c545c87485179212b6f5129d9 to your computer and use it in GitHub Desktop.
Save carpii/5fbdf15c545c87485179212b6f5129d9 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Disables invalid memory notifications on Synology NAS (including the notifications in DiskStation itself)
# these warnings occur when you use perfectly compatible RAM, which is not Synology branded
#
# Modify `MANUFACTURER` and `DBFILE` to match your environment (DBFILE will be the filename of the .db in DBPATH)
# Use Synology Task Scheduler to run it on boot, as root user
# Finally run `sudo ~/disable_ram_warning'
# This script is safe to run repeatedly, and will also work if Synology update DiskStation later, and make additions to the db file
MANUFACTURER='Kingston'
DBPATH="/var/lib/memory-compatibility/"
DBFILE='rs1221+_mem_host.db'
TMPFILE=".${DBFILE}.backup"
cat "${DBPATH}/${DBFILE}" | sed "s/[^_]${MANUFACTURER}/WHITELISTED_${MANUFACTURER}/" > ~/${TMPFILE}
RESULT="$?"
if [ "${RESULT}" == "0" ]; then
chmod 644 ~/${TMPFILE}
RESULT="$?"
fi
if [ "${RESULT}" == "0" ]; then
cp ~/${TMPFILE} "${DBPATH}/${DBFILE}"
RESULT="$?"
fi
if [ "${RESULT}" != "0" ]; then
SCRIPT=`realpath "${0}"`
echo "Warning: was unable to replace ${DBPATH}/${DBFILE} from ${SCRIPT}"
exit ${RESULT}
else
rm ~/${TMPFILE}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment