Optional Title
Mar 1, 2019
Category: Linux Administration
Posted by: admin

Limit concurrent requests to alleviate performance issues



Jan 26, 2019
Category: Linux Administration
Posted by: admin

Before you add your node, you need to set up authentication. 



Jan 23, 2019
Category: Linux Administration
Posted by: admin

Suppose you are on a vpn ... 



Dec 3, 2018
Category: Linux Administration
Posted by: admin

Extending a Linux Partition On a Running Server



Welcome to the expat blog

Jan 23, 2019

Diff the same file on two remote servers


Suppose you are on a vpn ... 

Category: Linux Administration
Posted by: admin

Suppose you are on a vpn with two identical servers, for need to ensure there are no differences between the two httpd.conf file on the remote servers.

The basic command is

diff <(ssh user@host1 "sudo cat/etc/httpd/conf/httpd.conf") <(ssh user@host2 "sudo cat /etc/httpd/conf/httpd.conf")

However if you needed to compare a folder of files on 8 servers you can compare the first against the other 7, if it fails you know at least one is different

#!/bin/bash

for server in {2..8};
   do
     for file in `ssh user@host$server "sudo ls /foldertoscan/*.xml"`;
        do
           diff <(ssh user@host1 "sudo cat $file") <(ssh user@host$server "sudo cat $file")
        done 
   done

 

Or to check they are actually the same file is way more efficient

#!/bin/bash

MSG=""

    for server in {2..8};
     do
        for file in `ssh user@host$server "sudo ls /foldertoscan/*.xml"`;
          do

             checksum1=`ssh user@host1 "md5sum $file"`
             checksum2=`ssh user@host$server "md5sum $file"`

                 if [ "$checksum1" != "$checksum2" ]; then
                   MSG="$MSG \n ERROR The file $file on server host1 has an md5 checksum of $checksum1 which differs from that of server host$server which is $checksum2\n\n"
                 fi

          done

   done

echo $MSG