Bash command to generate email alert on DC hard size is low in percentage

i want bash commands to generate alerts for my DC server hard drive size with percentage like

drive total-size free-size  %
C           200          100       50%


kindly help.
Sid ikramAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

murugesandinsShell_script Automation /bin/bash /bin/bash.exe /bin/ksh /bin/mksh.exe AIX C C++ CYGWIN_NT HP-UX Linux MINGW32 MINGW64 SunOS Windows_NTCommented:
Based on the operating system you need to use related commands:
Example:
At Linux or HP-UX use
MAILCMD=/usr/bin/mailx

Open in new window

At AIX use
MAILCMD=/usr/bin/mail

Open in new window

Here I have mentioned mail or mailx at /usr/bin/ directory. Change that location if required.
if Linux
echo Write the content here >MailContent.txt
#either
bdf -h >>MailContent.txt
#or
df -h  >>MailContent.txt
#or
du -h  >>MailContent.txt#always use full path of any commands df or du or bdf or any other commands.
$MAILCMD -q MailContent.txt -s "Subject" -a attachment.txt

Open in new window

for AIX ( I have used uuencode, use full path of uuencode)
(echo Mail content;uuencode attachment.txt ''`/bin/basename attachment.txt`'') | $MAILCMD -s "Subject" -a attachment.txt

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
murugesandinsShell_script Automation /bin/bash /bin/bash.exe /bin/ksh /bin/mksh.exe AIX C C++ CYGWIN_NT HP-UX Linux MINGW32 MINGW64 SunOS Windows_NTCommented:
@Sid ikram
Question inactive for 14 days.
If receiving same mail again, given solution will be accepted forcefully.
0
murugesandinsShell_script Automation /bin/bash /bin/bash.exe /bin/ksh /bin/mksh.exe AIX C C++ CYGWIN_NT HP-UX Linux MINGW32 MINGW64 SunOS Windows_NTCommented:
Closing this query since question being inactive.
Also include full path for
bdf or du or any commands.
[code]
/bin/ls -ld /*/*/bdf /*/*/du /*/bdf /*/du 2>/dev/null
[/code]
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.