Created
January 26, 2016 22:42
-
-
Save jcefoli/597067f8fe9d79063ac2 to your computer and use it in GitHub Desktop.
Sends An Email With the Number of Documents in a MongoDB Collection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
myCollectionCount=`mongo -u user -p password database_name --quiet --eval 'db.getCollection("my_collection").count()'` | |
echo "my_collection Count: $myCollectionCount > disk.txt | |
echo >> disk.txt | |
df /dev/mapper/volume-group >> disk.txt | |
cat disk.txt | mail -S smtp="smtp.relay.tld:25" -r "From Name<[email protected]>" -s "Email Subject" -v "[email protected]" | |
rm disk.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment