Ubiquiti ERL script wanted to compare md5 values
-
Happy now?
jbusch@jared:~$ md5sum -c /config/bad.md5 && echo "Successful test of MD5" || echo "Failed test of MD5" /root.dev/squashfs.img: OK /root.dev/squashfs.o: FAILED md5sum: WARNING: 1 of 2 computed checksums did NOT match Failed test of MD5 jbusch@jared:~$ md5sum -c /config/good.md5 && echo "Successful test of MD5" || echo "Failed test of MD5" /root.dev/squashfs.img: OK /root.dev/squashfs.o: OK Successful test of MD5 jbusch@jared:~$
-
Yes better
Don't forget the 2>/dev/null so you only get the result message.
-
what is the 2 for? it still printed instead of sending the output to /dev/null
jbusch@jared:~$ md5sum -c /config/good.md5 2>/dev/null && echo "Successful test of MD5" || echo "Failed test of MD5" /root.dev/squashfs.img: OK /root.dev/squashfs.o: OK Successful test of MD5 jbusch@jared:~$ md5sum -c /config/good.md5 > /dev/null && echo "Successful test of MD5" || echo "Failed test of MD5" Successful test of MD5
-
Argh, I must be getting tired.
The 2 is good but not what we wanted. Just drop the 2 completely. Just >/dev/null
-
That's better, no extraneous junk. Just pass or fail.
-
Now if you want to run that every five minutes or hourly or daily or whatever you can pop it into the crontab and it will run it for you.
-
@scottalanmiller said:
Argh, I must be getting tired.
The 2 is good but not what we wanted. Just drop the 2 completely. Just >/dev/null
I did. if you look again. And I even recalled the piping output to dev.null once i seen it fail. Like, oh yeah, I learned this a time or three..
-
@scottalanmiller said:
Now if you want to run that every five minutes or hourly or daily or whatever you can pop it into the crontab and it will run it for you.
Yeah, I am thinking weekly to /var/log/ or something on success and the log and email on a problem.
But, now that I am this far on it, I want to look at not having to create the good.md5 on each ERL and after every upgrade (because the value will change). SO, I may need an actual bash script.
But that is not for tonight.
-
Posted over on the UBNT forums.. We'll see what happens. I am heading to bed i think.
-
Good night.