Problem writing script
#!/bin/bash
cd pool if [ $( find -maxdepth 1 | grep -cv '^\.$' ) -gt 50 ]; then "Pool >= " find -maxdepth " - check for flooding!" | mail -s "Server Flooding Notice" me@my.net fi I am trying to write a script that will alert me if a directory get too many files therein. I want the script to send the find -maxdepth 1 | grep -cv '^\.$' info placed between the text in quotes. Thanks. |
I can get the echo "Pool >= 40: " when it is sent alone, but when the find follows, the find numbers show up without the preceeding echo.
echo "Pool >= 40: " | find -maxdepth 1 | grep -cv '^\.$' | mail -s "Server Flooding Notice" me@my.net |
Code:
#!/bin/bash |
I am curious why when you ran the commands the first time you placed them inside $()?
|
Beats me, I copied to code from a Linux sample site :).
I'm just an itty, bitty, Linux baby who thinks that he is smarter by half than everyone else! Thanks for everyone's help. |
Well we all start somewhere and mine was a clue to help rather than a solution .... ie if you look up what that construct does you might just find out why your original script did not work :)
|
All times are GMT -5. The time now is 09:21 AM. |