Aller au contenu | Aller au menu | Aller à la recherche

mardi 20 septembre 2016

Backup MBR (disaster recovery)

set -x
## script de backup MBR ##
## admin_blog@nicolascharbonnier.fr ##
# verification du repertoire de backup #
if [[ ! ( -d $BACKUP_DIR )  ]]
mkdir -p $BACKUP_DIR ;
## création du backup ##
# date du jour #
DATE=`date +"%y%m%d"`
dd if=/dev/sda of=$BACKUP_DIR/mbr_$DATE bs=512 count=1

lundi 11 juillet 2016

Admin message

Hi all,

i make this topic to answer at all ask about how this blog write up, which software / CSS used etc ...

This is a blog from a free template offer By Gandi.fr blog.

This CSS, use dotclear, but nothing else than buying a Domain name is necessary to use this CSS / blog method.

So, to reply about bug possible encounter with IE or any android / IOS bug, i can't devel about this. If there are some bug they stay. Only Gandi could make some change, update about this CSS or any other development.

If you need contact me, use "contact" right button !


mercredi 15 juin 2016

SSH command and usefull option

many option about ssh command are not describe into man, and when you need to automatic some script, it could be usefull to bypath some ask from default ssh command

exemple : (more info into man ssh_config)

  • ConnectTimeout=xx is about to stop connection if no reply after x sec
  • PasswordAuthentication=yes|no   Dont ask password (default yes)
  • ChallengeResponseAuthentication=yes|no   (default yes)
  • BatchMode=yes|no  this disable passphrase / password ask , really usefull for scripting (default no)
  • StrictHostKeyChecking=yes|no|ask  (default ask) usefull to add automatically new server authkey into ~/.ssh/known_hosts whitout asking

a usefull ssh  command exemple :



# for i in `cat $LISTE_SERV` ; do ssh $i -o BatchMode=yes -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o ChallengeResponseAuthentication=no "command into ssh tunnel" >> $LOG_OUT ; done

 To copy ssh public key on remote server using SSH :

cat ~/.ssh/id_dsa.pub | ssh ${username}@${remote_server} "touch ~/.ssh/authorized_keys && cat - >> ~/.ssh/authorized_keys" ; exit 0

To get more options about scanning all your Unix-Linux information system you can use this script as below.

mardi 17 mai 2016

Astuces Awk

Autant `Cut` je gère, autant AWK est un outil assez puissant qui permet bien plus de possibilités.
Et à chaque fois je cherche sur le net la bonne syntaxe, et bien je vais regrouper ici les commandes awk que j'utilise régulièrement sous forme d'exemple :

chkconfig avec le tri par colonne  :

chkconfig --list |egrep "tomcatxxx|tomcatyyy|tomcatzzz|apachexxx"  |awk '{FS="\t"} {print $1,$5}'

Sortie :

apachexxx 3:on
apachexxx3      3:on
tomcatyyy1        3:on
tomcatxxx1      3:on
tomcatxxx2      3:on
tomcatzzz3      3:on
tomcatxxx4      3:on

Afficher la colonne 1 en greppant sur la colonne 2 si la valeur de la colonne 2 est égal à "0":

 awk '$2 == 0 {print $1}' liste_test

mercredi 4 mai 2016

HowTo create mirror LVM with pacemaker HA-cluster RHEL 7


here about a tips to add / remove an LV using raid mirror with multiple slice and all that with HA-cluster RHEL 7.1

HA-cluster is monitored by Pacemaker

why this ticket ?

Just becaus there is a redhat bug implementation and RedHat support don't find alone solution.

So, first the need is : (we have already 4 PV using multipath, and 1 VG "vgtest" already using pacemaker resource)

lvcreate -m1 -i2 -I 128 -L 200m -n test4 vgtest /dev/mapper/pv1-1 /dev/mapper/pv2-1 /dev/mapper/pv1-2 /dev/mapper/pv2-2

First, we have to stop resource onto active node
pcs resource disable $resource_name_vgtest

then we need to reconfigure /etc/lvm/lvm.conf

locking_type = 1
ignore_lvm_mirrors = 0 => (set 1 if ou need remove a failed or inactive  LV/VG)
use_lvmetad = 1
## Add the VG into locale volume list group:
volume_list = [ "vgroot", "vgtest" ]

reload lvm :
systemctl restart lvm2-lvmetad

# create your LV with raid 1 onto 4 slice #
lvcreate -m1 -i2 -I 128 -L 200m -n test4 vgtest /dev/mapper/pv1-1 /dev/mapper/pv2-1 /dev/mapper/pv1-2 /dev/mapper/pv2-2
# format it - default xfs under RHEL 7 #
mkfs.xfs /dev/vgtest/test4  or /dev/mapper/vgtest-test4

## backoff local LV to cluster ##
edit /etc/lvm/lvm.conf and change to this properties
 volume_list = [ "vgroot" ]

# reload lvm service
systemctl restart lvm2-lvmetad

# enable pacemaker resource
pcs resource enable $resource_name_vgtest

You can check it :
pcs resource  || pcs status
## all have to be "started" ##

## Then you can mount this Lv as any other FileSystem mount method ##

## If not all started, use a clean to purge all failed and redetect status
pcs resource cleanup $Resource_name

- page 1 de 14