- Joined
- May 28, 2011
- Messages
- 10,996
I'm working on my MiniDLNA project and trying to find out how I can turn on the Alert Flash (yellow and red) and add a short message from within the plugin, from a script.
There is a limitation that when reached, well before it's reached I'd like to send out an alert message (yellow) and when it is reached I want to send out an alert message (red).
Here is some test code that I'm working with right now and you can see I'm just placing some text into a log file for right now. Using the Alert is a better method plus I can use a log file to report additional information.
Thanks
There is a limitation that when reached, well before it's reached I'd like to send out an alert message (yellow) and when it is reached I want to send out an alert message (red).
Here is some test code that I'm working with right now and you can see I'm just placing some text into a log file for right now. Using the Alert is a better method plus I can use a log file to report additional information.
Code:
#!/bin/sh
#Testcode
while :; do
directories=$(find /media -type d -print0 | xargs -0 -I % echo -n '"%" ')
echo "Checking String Length..."
echo " "
echo "Your directory string length is: "${#directories}
echo " "
# Check on maximum length of directory string.
if [ ${#directories} -gt 260000 ];
then
if [ ${#directories} -gt 261649 ];
then
echo "Red Alert"
date > /minidlnaerror.log
echo "You have exceeded the maximum directory string length of 261649 and you are currently at" >> /minidlnaerror.log
echo ${#directories}". You need to shorten the directory names or rearange your folders" >> /minidlnaerror.log
echo "to remove this error." >> /minidlnaerror.log
echo " " >> /minidlnaerror.log
else
echo "Yellow Alert"
date > /minidlnaerror.log
echo "The maximum directory string length is 261649 and you are currently at" >> /minidlnaerror.log
echo ${#directories}". You should shorten the directory names or rearange your folders" >> /minidlnaerror.log
echo "to remove this error." >> /minidlnaerror.log
echo " " >> /minidlnaerror.log
fi
fi
csh -c "wait_on -w $directories"
sleep 2
done
Thanks