Bash Shell script to check the existence of a file under your linux filesystem August 3, 2010
Posted by networknuts in Uncategorized.Tags: bash shell scripting, delhi linux, linux delhi, linux training, Network NUTS, redhat, redhat linux, rhce, rhce delhi, rhce india, rhcss, rhcss delhi, rhcss india, rhcva, shell scripting, training
1 comment so far
Here is a very small but useful shell script that will check the existence of a file and report accordingly.
#!/bin/bash
#by alok srivastava
#check the existence of a file under your filesystem
#this bash shell script use "positional parameters"file=$1
[ $# -eq 0 ] && { echo "Usage: $0 filename"; exit 999; }
if [ -f $file ];
then
echo "YES - File $file exists."
else
echo "NO - File $file does NOT exists."
fi
It can be very useful while creating more complex bash shell scripts.
Here is a sample execution shown for your reference:
Shell Script taking Time bound Input !! May 13, 2010
Posted by networknuts in Uncategorized.Tags: linux shell scripting, Network NUTS, networknuts.net, rhce delhi, rhce india, rhcss india, shell scripting, shell scripting course, shell scripting course delhi, shell scripting delhi
add a comment
Here is a simple shell script that will take the input from user keyboard and displays it on the screen. But the idea is not that!!!
Idea is to show you, how to take “time bound” input for sensitive information.
vim timed_read.sh
and here is the script…
#!/bin/bash
#alok srivastava
#taking time bound inputTIMEOUTLIMIT=4 # 4 seconds of wait
echo “type something “
read -t $TIMEOUTLIMIT first <&1
echoif [ -z "$first" ]
then
echo “timed out.. sorry”
else
echo “you typed $first”
fiexit 0 # exit clean
When you execute this script using “sh time_bound.sh” and give some input within the time frame of 4 seconds it will be displayed.. else the script will exit cleanly after waiting for 4 seconds. As shown:
God Bless.
Linux Bash Shell Script to clear logs automatically – VIDEO April 25, 2010
Posted by networknuts in Uncategorized.Tags: bash shell script, linux bash scripting video, linux scripting, linux video, mcse delhi, mcse india, Network NUTS, rhce, rhce boot camp, rhce delhi, rhce india, rhcss boot camp, rhcss delhi, rhcss india
add a comment
Video by www.networknuts.net, showing how to create a linux bash shell script to clear logs automatically and carefully.
God Bless.
Apache Load Balancing VIDEO using “pound” April 5, 2010
Posted by networknuts in 1.Tags: apache, apache load balancing, linux video, Network NUTS, redhat, redhat certification, redhat linux, rhce delhi, rhce india, rhce training, rhce video, rhcss delhi, rhcss india, rhcss training, rhct video
add a comment
Check the apache load balancing done using “pound” video on – You Tube.
http://www.youtube.com/watch?v=-WuW27hpHWc
God Bless.
100% Result in RHCSS (EX 429) exam April 3, 2010
Posted by networknuts in 1.Tags: Network NUTS, redhat, redhat india, redhat linux, rhcss, rhcss boot camp, rhcss delhi, rhcss india, rhcss result
add a comment
Network NUTS congratulates all his students for creating one more landmark in Red Hat Linux RHCSS certification.
In the last “Red Hat Enterprise SELinux Policy Administration (EX429)” exam held on 02/04/2010, Network NUTS has achieved 100% pass result.
Congratulates to all the Certified Students:
Mr. Rajnesh Kr. Siwal
Mr. Aditya Gandhi
Mr. Tarpan
Mr. Prabhat Chauhan
Mr. B. Sudhir
Mr. K.R Venkataraman
Network NUTS wishes you all the best!!!
Block music/download through Squid February 26, 2010
Posted by networknuts in 1.Tags: best training, block download using squid, linux, Network NUTS, redhat, rhca, rhce exam, rhce india, rhce training, rhcss india, rhcss training, squid, squid configuration
add a comment
We might need to BLOCK certain types of files to be downloaded, like mp3/mpeg/avi/exe and other and display our customized error-message.
STEP #1 – vim /etc/squid/squid.conf — add these lines under your ACL section
acl blockfiles urlpath_regex "/etc/squid/blocks.files.acl"
# Deny all blocked extension
deny_info ERR_BLOCKED_FILES blockfiles
http_access deny blockfiles
STEP #2 – Create rule file for blocking certain types of file.
vi /etc/squid/blocks.files.acl
\.[Ee][Xx][Ee]$
\.[Aa][Vv][Ii]$
\.[Mm][Pp][Gg]$
\.[Mm][Pp][Ee][Gg]$
\.[Mm][Pp]3$
STEP #3 – Create customized error file under /usr/share/squid/errors/English/ directory.
vi ERR_BLOCKED_FILES
<HTML>
<HEAD>
<TITLE>ERROR: Blocked file content</TITLE>
</HEAD> <BODY>
<H1>File is blocked due to our IT policy</H1>
<p>Please contact Network NUTS admin for more information:</p>
STEP #4 - Restart the squid service.
service squid restart; chkconfig squid on
God Bless.
Check more on linux at http://networknuts.net
Disable mail alert by CRON January 25, 2010
Posted by networknuts in 1.Tags: crontab, crontab -e, disable mail alert cron, india's best training institute, Network NUTS, redhat, redhat linux, rhca, rhcss
add a comment
Normally, we had seen that after the crontab executes your cron job it sends you a email as a notification on root email.
I don’t want the email to be send on root account.
Here is how you can do this:
METHOD #1 - Add any one of the following at the end of the line for each cron job to redirect output to /dev/null.
>/dev/null 2>&1.
OR
&> /dev/null
Example – 1:
40 16 * * * /bin/echo "this will not be emailed to root" > /dev/null 2>&1
Example – 2:
40 16 * * * /bin/echo "this will not be emailed to root" &> /dev/null
So when this command will be executed by cron, NO email will be send on root account.
METHOD #2 – Disable mail by using MAILTO variable.
Just when you do crontab -e for editing your cron jobs. Add
MAILTO=" "
as your first line in the crontab file.
Enjoy.
God Bless.
Sapient India trust Network NUTS for MS Exchange training October 28, 2009
Posted by networknuts in 1.Tags: Best computer training in India, Microsoft Exchange training India, MS Exchange 2007 training, Network, Network NUTS, RHCE in India, RHCSS In India
add a comment
Sapient India ( http://www.sapient.com/en-in)
One of the world’s top business and IT consulting company has chosen “Network NUTS” for their Microsoft Exchange 2007 training to be imparted to their technical staff.
The training is scheduled to start in November, 2009.
Our high technical standards are also acknowledged by world’s top IT companies.
“Our students set our standards, our job is to meet them”
