-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Both InnoDB and PostgreSQL - as well as many other databases - use a technique called multi-version concurrency control (MVCC) to provide transaction isolation: transactions should not see the work of other, uncommitted transactions. MVCC means that, when a row is updated, the database stores both the old and new versions of the row.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Friday, December 23, 2011

Multiple Purpose Expect Script

DISK ALERT - Expect ScriptHi All, here's I have bring a expect script, that this we can Run command on Remote Linux Servers, copy file using SSHSo here it is:
[root@virtual-vm ~]#  yum install expect  (if expect package is not installed)
[root@virtual-vm ~]#  vi  /opt/scripts/diskspace-alerts.expDISK ALERT - Expect Script
#!/usr/bin/expect

set logfile [open /opt/scripts/iplist]

set ipaddrs [read $logfile]

 

foreach line [split $ipaddrs \n] {

set timeout -1

        spawn ssh cube@$line /sbin/ifconfig eth0 | /bin/grep 'inet addr' | /bin/awk '{print \$2}'  | /bin/cut -d: -f2

        set pass "ssh-password"

        set ya "yes"

        expect {

        password: {send "$pass\r"; exp_continue}

        connecting {send "$ya\r"; exp_continue}   

        }

        spawn ssh cube@$line /bin/df -hlP | sed G

        set pass "ssh-passowrd"

        expect {

        password: {send "$pass\r"; exp_continue}

        }

}

/opt/scripts/iplist:  contains IP address of servers, on which you may want to run the commands

Set this in Cron:
expect /opt/scripts/diskspace-alerts.exp | egrep -v 'spwan|cube|ssh' > /tmp/diskspace-alert.txt ; /usr/sbin/postsuper -d ALL; /etc/init.d/postfix start; mail -s "Disk space alert - IBNLive.com" delhi.manish@gmail.com < /tmp/diskspace-alert.txt ; sleep 10; /etc/init.d/postfix stop

Use your own choice of Mail Server

1 comment:

  1. Still remember major reason why we have explore the expect command & how we have customized it...

    ReplyDelete