Outils pour utilisateurs

Outils du site


blog

DNS script check bind9

check-bind.sh

#! /bin/bash
 
declare -i RET
RET=0
 
rndc reload
systemctl restart named.service
systemctl status named.service
RET=$((RET + $?))
 
IP_DNS=$(dig @127.0.0.1 plop.acme.local +short)
if [ -z "$IP_DNS" ]
then
        RET=$((RET + 1 ))
fi
 
FQDN_DNS=$(dig @127.0.0.1 -x "$IP_DNS" +short)
if [ -z "$FQDN_DNS" ]
then
        RET=$((RET + 1 ))
fi
 
 
named-checkconf
RET=$((RET + $?))
 
for ZONE in $(awk '/^zone/ { gsub("\"", "") ; print $2 }'  /etc/named.conf)
do
        named-checkzone "$ZONE" "/etc/named/db.${ZONE}"
        RET=$((RET + $?))
        dig -t AXFR @127.0.0.1 "$ZONE" |grep -v "^;;"
        RET=$((RET + $?))
        rndc freeze acme.local
        rndc reload acme.local
        RET=$((RET + $?))
        rndc thaw acme.local
done
 
rndc status
RET=$((RET + $?))
 
 
echo
if [ $RET == 0 ]
then
        echo "*** ALL IS OK ***"
else
        echo "** ERROR ***"
fi
echo
 
exit $RET
2025/03/24 15:06

Disque cache flush sync io purge

Source :

drop_caches.sh

echo 3 |sudo tee /proc/sys/vm/drop_caches
#!/bin/bash
sync
echo 3 >/proc/sys/vm/drop_caches
swapoff -a && swapon -a
# (move data, modified through FS -> HDD cache) + flush HDD cache
sync
 
# (slab + pagecache) -> HDD (https://www.kernel.org/doc/Documentation/sysctl/vm.txt)
echo 3 > /proc/sys/vm/drop_caches 
 
blockdev --flushbufs /dev/sda
hdparm -F /dev/sda
 
#  Command that should be run before unplug, flushes everything guaranteed
echo 1 > /sys/block/sdX/device/delete

watch the progress of a `sync` operation Source : http://unix.stackexchange.com/questions/48235/can-i-watch-the-progress-of-a-sync-operation

watch grep -e Dirty: -e Writeback: /proc/meminfo
awk '{print $9}' /sys/block/sda/stat
2025/03/24 15:06

Display manager

Quel est mon Display Manager ?

Debian /etc/X11/default-display-manager
RedHat /etc/sysconfig/desktop
OpenSuSe /etc/sysconfig/displaymanager
Debian /etc/X11/default-display-manager
cat /etc/X11/default-display-manager
systemctl status display-manager
pstree -alps $$

sddm

autologon
mkdir /etc/sddm.conf.d
# ls /usr/share/xsessions/
lxqt.desktop

/etc/sddm.conf.d/autologin.conf

[Autologin]
User=jean
Session=lxqt.desktop
Relogin=
2025/03/24 15:06

Diagramme sous GNU/Linux

Voir :

Logos libres en SVG :

Voir aussi : FIXME

  • Diagramme en Code avec PlantUML

http://www.softia-systems.net/contribs/dia_split_svg.py

#
#	Script realise par THOMAS DUBOIS pour SOFTIA SYSTEMS
#       BSD LICENCE
#	Merci d'envoyer un mail a tdubois@softia-systems.net
#	si vous utilisez, transmettez, ou reactualiser le script
#	(juste pour un suivi du travail :))
#	Finalise le 28/08/2007
#
 
# Ce script ne prends pas d'argument.
# Il creera dans le repertoire courant un repertoire svg, et shape
# Le repertoire svg contiendra les .svg de chaque objet
# Le repertoire shape contiendra les .shape correspondant au SVG ainsi 
# qu'un PNG pour la preview
# Un fichier Yourshape.sheet sera creer.
# Le fichier .sheet doit etre modifier afin de changer
# le nom de la feuille apparaissant dans dia
 
# Le fichier shape est a copier dans votre ~/.dia/shape/Votreshape
# Le fichier Yourshape.sheet est a copier dans le repertoire ~/dia/sheets/
# sous le nom Votreshape.sheet
 
 
 
# Debut du script
 
from xml.dom import minidom
# Fichier SVG d'entree a parser
xmldoc = minidom.parse('/path/to/file.svg')
 
# probleme de locale, pas trouve d'autre solution ....
# si quelqu'un a qqchose a proposer
import locale, sys
reload(sys)
loc = locale.getdefaultlocale()
if loc[1]:
    encoding = loc[1]
 
# une version Non-Unicode retournera AttributeError...
if encoding:
    sys.setdefaultencoding(encoding)
 
 
import os
import re
import popen2
 
# recuperation des groups d'element, ici les objets
reflist = xmldoc.getElementsByTagName('g')
 
shapehead = """<?xml version="1.0"?>
 
<shape xmlns="http://www.daa.com.au/~james/dia-shape-ns"
xmlns:svg="http://www.w3.org/2000/svg">
"""
 
shapetail = """
</svg:svg>
</shape>"""
 
 
svghead = """<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 
<svg xmlns="http://www.w3.org/2000/svg">
"""
 
svgtail = "\n</svg>"
 
# Creation du fichier sheet
sheetfile = open("YourSheet.sheet", "w")
sheetfile.write("""<?xml version="1.0" encoding="iso-8859-1"?>
 
<sheet xmlns="http://www.lysator.liu.se/~alla/dia/dia-sheet-ns">
  <name>Sample</name>
  <description>A collection of sample shapes.</description>
  <contents>
""")
 
# Creation de repertoires pour stocker les fichiers
os.mkdir("svg")
os.mkdir("shape")
 
i = 0
for block in reflist:
	#ouverture du fichier svg de l'objet courant et ecriture des entetes
	svgfile = open("svg/" + str(i) + ".svg", 'w')
	svgfile.write(svghead)
	svgfile.write("<desc>%i</desc>\n"%(i))
	shapefile = open("shape/" + str(i) + ".shape", 'w')
	shapefile.write(shapehead)
	shapefile.write("<name>%s</name>\n"%(i))
	shapefile.write("<icon>%s.png</icon>\n<svg:svg>\n"%(i))
 
	# Regexp pour enlever nombre de classes qui sont incompatible avec dia
	p = re.compile('sodipodi:[a-z0-9\-]+=".*?\"')
	chaine =  p.sub('', block.toxml())
	svgfile.write(chaine)
	chaine = chaine.replace("<a:","")
	chaine = chaine.replace("<","<svg:")
	chaine = chaine.replace("<svg:/","</svg:")
	p = re.compile('i:[a-z\-]+=".*?\"')
	chaine =  p.sub('', chaine)
	p = re.compile('inkscape:[a-z\-]+=".*?\"')
	chaine =  p.sub('', chaine)
	shapefile.write(chaine)
	shapefile.write(shapetail)
	shapefile.close()
	sheetfile.write("<object name=\"%s\">\n"%(i))
	sheetfile.write("<description>%s</description>\n"%(i))
	sheetfile.write("</object>\n")
	# conversion des .svg de chaque objet svg en png
	popen2.popen3("/usr/bin/inkscape svg/%s.svg -e shape/%s.png -d 90 -z -D"%(i,i))
	shapefile.close()
	svgfile.write(svgtail)
	svgfile.close()
	i += 1
 
sheetfile.write("""</contents>
</sheet>""")
sheetfile.close()
2025/03/24 15:06

DHCP DNS - Désactiver la mise à jour du fichier /etc/resolv.conf

Conf dhclient.conf

Nettoyer la conf de l'ancien DHCP

killall dhclient
rm /var/lib/dhcp/*.leases
> /etc/resolv.conf

Forcer un ou plusieurs serveurs DNS /etc/dhcp/dhclient.conf

supersede domain-name "example.com";
supersede domain-search "example.com";
supersede domain-name-servers 127.0.0.1;
#supersede domain-name-servers 8.8.8.8, 8.8.4.4;

RedHat

/etc/sysconfig/network-scripts/ifcfg-enp0s3

PEERDNS=no

Debian

Voir : https://wiki.debian.org/resolv.conf

echo 'make_resolv_conf() { :; }' > /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone
chmod 755 /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone
Autres

/etc/network/interfaces

 iface eth0 inet static
    address 192.168.1.3
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameserver 192.168.1.254
    dns-nameserver 8.8.8.8
    dns-search foo.org bar.com

NetworkManager

Obsolète /etc/NetworkManager/NetworkManager.conf

[main]
#dns=dnsmasq
dns=none

Solution

nmcli connection edit Livebox-2277
nmcli> goto ipv4
nmcli ipv4> set ignore-auto-dns
Saisissez la valeur « ignore-auto-dns » : true
nmcli ipv4> save permanent
Connexion « Livebox-2277 » (50247bd3-25f1-41a7-b96c-2bd40462423a) mise à jour.
nmcli connection up Livebox-2277

Faire pareille pour ipv6

ou

nmcli connection modify Livebox-2277 ipv4.ignore-auto-dns true
nmcli connection modify Livebox-2277 ipv6.ignore-auto-dns true

Autres

root@raspberrypi:/home/pi# cat /etc/resolv.conf
# Generated by resolvconf
domain home
nameserver 192.168.1.1
root@raspberrypi:/home/pi# which resolvconf 
/sbin/resolvconf
root@raspberrypi:/home/pi# dpkg -S /sbin/resolvconf
openresolv: /sbin/resolvconf
2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki