cksum – compare for multiple files.

If you have to compare cksum for couple of files, the you know how cumbersome it is. So, I wrote a simple script, wherein you can create a file called cksums in the current directory and copy paste the result ofย  “cksums *”ย  into this file, and then run this script. Cool ๐Ÿ™‚

#!/bin/bash -
#===============================================================================
#
#          FILE: checkcksums.sh
#
#         USAGE: ./checkcksums.sh
#
#   DESCRIPTION: Compare cksums of multiple files.
#
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (),
#  ORGANIZATION:
#       CREATED: 02/22/2013 09:12:17 PM IST
#      REVISION:  ---
#===============================================================================

file=cksums
while read line
do
    a=( $(echo $line) )
    if [[ -f ${a[2]} ]]
    then
        b=( $(cksum ${a[2]}) )
        if [[ $a == $b ]]
        then
            echo "Cksum for ${a[2]} = ${a[0]} matches"
        else
            echo "Failed ::Cksum for ${a[2]} = ${a[0]} matches"
        fi
    else
        echo "Failed :: file ${a[2]} does not exist"
    fi
done < $file
Enhanced by Zemanta

configure firewall – the easy way.

It is good practice to keep iptables/firewall enabled. But configuring it is difficult, do you agree. Not any more ๐Ÿ™‚

Install firewall-config

sudo yum install firewall-config

This will install a GUI application, which you can run with “Firewall” application in the dash or with “firewall-config” in terminal. It is pretty straight forward to use this tool, even if you don’t have much knowledge on Firewall/iptables.

 

Enhanced by Zemanta

sendmail or sending mail

If you want to use sendmail so that you can send all your mails from the local system to your email address, then you have to use sendmail.ย  Now, configuring sendmail has never been that easy and if you are working internally on your corporate network then for sending mails to the same domain, generally you don’t have to login. That being the case, you can use something simpler like “sstmp“. Install ssmtp with:

sudo yum install ssmtp

and then just open the file “/etc/ssmtp/ssmtp.conf”, change the email address, and you should be done. If your mail host is not reachable as “mail“, then you might need to change mailhub. Just check the alternatives with “galternatives” to make sure that mta/sendmail alternative default is set to “ssmtp“.

 

Enhanced by Zemanta