I threw this together last night since I had an out of memory issue, I assume restarting the reef-pi service would reset the memory usage. It still needs some cleanup and some additional error checking to verify that the service started up. The basic idea is you drop this in cron.daily (/etc/cron.daily) which is executed at 3am your local time, if the available free memory is less than 150M then it will restart the reef-pi service. Outputs to a file in your directory the information for the free command and also if it restarts the service. Update the file with your path to your home directory.
Code:#!/bin/bash /bin/date > /home/bishop/pi-memory.txt /usr/bin/free >> /home/bishop/pi-memory.txt freemem=`/usr/bin/awk '{print $7}' /home/bishop/pi-memory.txt` if (( $freemem < 150000 )) then /bin/echo $freemem >> /home/bishop/pi-memory.txt /bin/echo "restarting reef-pi" >> /home/bishop/pi-memory.txt /bin/systemctl restart reef-pi.service else /bin/echo "not less that 150M" >> /home/bishop/pi-memory.txt fi
If anyone has any questions or something that would work better just let me know, just wanted something to check things overnight and reset if necessary, no warranties as usual ;)
Saaay whaaaaat? No warranty! Or you could just go the route of what so many manufacturers/suppliers appear to be going in this hobby; offer a warranty that's useless. There's nothing wrong with our product but, rather, it's the way you used it or didn't use it or maintained it or didn't maintain it or looked at it funny... ;);)
Thanks for providing all the help you have been providing lately!
