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

Sid ikram
Sid ikram used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Shell_script Automation /bin/bash /bin/bash.exe /bin/ksh /bin/mksh.exe AIX C C++ CYGWIN_NT HP-UX Linux MINGW32 MINGW64 SunOS Windows_NT
Commented:
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

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_NT

Commented:
@Sid ikram
Question inactive for 14 days.
If receiving same mail again, given solution will be accepted forcefully.
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_NT

Commented:
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]

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial