Learn Unix Shell Scripting Training from the Best Tutors
Search in
Lesson Posted on 03/03/2021 Learn Unix Shell Scripting Training
Unix (Automation for Disk space Alert on Server using Shell Script)
Umesh Prasad
I am having 10+ years of vast experience in Python, Unix ,Linux ,Shell Scripting and Perl Scripting.I...
disk_check_advance.sh
#!/bin/ksh
var=`df -a|grep home|tail -1|awk '{print $3}'`
HOST=`hostname`
echo $var1
if [ $var -le 3000000 ]; then
df -h|grep home >data
# du -s /home/* 2>/dev/null| sort -rn |head -20>>data
# cat data|
# mail -s "Alert: Almost out of disk space on $HOST" umesh.prasad@fedex.com
while read line; do
ED=`echo $line|cut -d "/" -f3`
ID=`echo $line|cut -d "/" -f3|cut -c1`
if [ "$ID" == "f" ]
then
ID1=`echo $ED|cut -c2-`
`echo $line | mail -s "Alert:Almost out of Disk space on $HOST" $ID1@fedex.com`
else
ID1=`echo $ED|cut -c3-`
`echo $line | mail -s "Alert:Almost out of Disk space on $HOST" $ID1@fedex.com`
fi
done < data
fi
Answered on 03 May Learn Unix Shell Scripting Training
Deepika Agrawal
"Balancing minds, one ledger at a time." "Counting on expertise to balance your knowledge."
Microsoft Windows is an operating system that features a graphical user interface and compatibility with a wide range of hardware and software, primarily for personal computers. UNIX is a multitasking, multi-user operating system developed for workstations, servers, and other devices
read lessAnswered on 16 May Learn Unix Shell Scripting Training
Pranjal B.
Learn Unix Shell Scripting Training from the Best Tutors
Answered on 02 May Learn Unix Shell Scripting Training
Deepika Agrawal
"Balancing minds, one ledger at a time." "Counting on expertise to balance your knowledge."
Answered on 02 May Learn Unix Shell Scripting Training
Deepika Agrawal
"Balancing minds, one ledger at a time." "Counting on expertise to balance your knowledge."
Echo is a Unix/Linux command tool used for displaying lines of text or string which are passed as arguments on the command line. This is one of the basic command in linux and most commonly used in shell scripts. In this tutorial, we will look at the different options of echo command.
read lessAnswered on 02 May Learn Unix Shell Scripting Training
Deepika Agrawal
"Balancing minds, one ledger at a time." "Counting on expertise to balance your knowledge."
Shell scripting is primarily used to automate repetitive system tasks, such as backing up files, monitoring system resources, and managing user accounts. By turning a series of commands into a script, system administrators can save time, increase accuracy, and simplify complex tasks.
read lessLearn Unix Shell Scripting Training from the Best Tutors
Answered on 02 May Learn Unix Shell Scripting Training
Deepika Agrawal
"Balancing minds, one ledger at a time." "Counting on expertise to balance your knowledge."
Because of its open-source status, adaptability, control, and reliability, Linux is a preferred operating system among ethical hackers. For hacking and penetration testing, Linux provides a wide range of tools and applications. Its command-line interface makes difficult and automated tasks simpler.
read lessAnswered on 02 May Learn Unix Shell Scripting Training
Deepika Agrawal
"Balancing minds, one ledger at a time." "Counting on expertise to balance your knowledge."
Answered on 02 May Learn Unix Shell Scripting Training
Deepika Agrawal
"Balancing minds, one ledger at a time." "Counting on expertise to balance your knowledge."
I have a bash application that is producing some result, and I'd like to echo the result to either stdout
or to a user chosen file. Because I also echo other interactive messages going to the screen, requiring the user to explicitly use the >
redirection when he wants to echo the result to a file is not an option (*), as those messages would also appear in the file.
Right now I have a solution, but it's ugly.
if [ -z $outfile ]
then
echo "$outbuf" # Write output buffer to the screen (stdout)
else
echo "$outbuf" > $outfile # Write output buffer to file
fi
I tried to have the variable $outfile
to be equal to stdout
, to &1
and perhaps something else but it would just write to file having that name and not actually to stdout. Is there a more elegant solution?
(*) I could cheat and use stderr
for that purpose, but I think it's also quite ugly, isn't it?
Learn Unix Shell Scripting Training from the Best Tutors
Answered on 01 May Learn Unix Shell Scripting Training
Deepika Agrawal
"Balancing minds, one ledger at a time." "Counting on expertise to balance your knowledge."
The ps command writes the status of active processes and if the -m flag is given, displays the associated kernel threads to standard output. While the -m flag displays threads associated with processes using extra lines, you must use the -o flag with the THREAD field specifier to display extra thread-related columns.
read lessUrbanPro.com helps you to connect with the best Unix Shell Scripting Training classes in India. Post Your Requirement today and get connected.
Ask a Question
The best tutors for Unix Shell Scripting Training Classes are on UrbanPro
The best Tutors for Unix Shell Scripting Training Classes are on UrbanPro