<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Gu!oN@&#039;s Blog</title>
	<atom:link href="http://blog.guiona.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.guiona.com</link>
	<description></description>
	<lastBuildDate>Tue, 03 Jan 2012 13:08:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Recherche et remplacement recursif?</title>
		<link>http://blog.guiona.com/2012/01/recherche-et-remplacement-recursif/</link>
		<comments>http://blog.guiona.com/2012/01/recherche-et-remplacement-recursif/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 13:08:24 +0000</pubDate>
		<dc:creator>Gu!oN@*</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[ksh]]></category>
		<category><![CDATA[sh]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[recursive]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://blog.guiona.com/?p=568</guid>
		<description><![CDATA[Qui n&#8217;a jamais eu besoin de faire une recherche récursive afin de remplacer une occurrence dans plusieurs fichiers? Pour se faire, nous allons combiner les commandes find, xargs et sed en version GNU obligatoirement sinon les options utilisées ne seront pas reconnues. Dans l&#8217;exemple ci-dessous nous allons remplacer l&#8217;occurence &#171;&#160;redmine.bilboplanet.com&#160;&#187; par &#171;&#160;chili.kiwais.com/projects/bilboplanet&#160;&#187; dans tout le [...]]]></description>
			<content:encoded><![CDATA[<p>Qui n&#8217;a jamais eu besoin de faire une recherche récursive afin de remplacer une occurrence dans plusieurs fichiers?<br />
Pour se faire, nous allons combiner les commandes find, xargs et sed en version GNU obligatoirement sinon  les options utilisées ne seront pas reconnues.</p>
<p>Dans l&#8217;exemple ci-dessous nous allons remplacer l&#8217;occurence &laquo;&nbsp;redmine.bilboplanet.com&nbsp;&raquo; par &laquo;&nbsp;chili.kiwais.com/projects/bilboplanet&nbsp;&raquo; dans tout le code source du <a href="http://www.bilboplanet.com">Bilboplanet</a>:</p>
<p>Nous allons commencer par rechercher tous les fichiers avec l&#8217;utilitaire &laquo;&nbsp;find&nbsp;&raquo;, pour cela on va utiliser deux options:</p>
<ul>
<li>L&#8217;option &laquo;&nbsp;-type f&nbsp;&raquo;: permet de ne rechercher que des fichiers.</li>
<li>L&#8217;option &laquo;&nbsp;-print0»: permet de remplacer le caractère espace par le caractère générique null (\0)</li>
</ul>
<p>Ce qui nous donne la commande suivante:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-print0</span></pre></div></div>

<p>En suivant, nous allons (au travers d&#8217;un pipe) utiliser la commande xargs pour gérer la sortie du process find avec l&#8217;option suivante:</p>
<ul>
<li>L&#8217;option -0 permet la gestion du caractère null</li>
</ul>
<p>Suivi de &laquo;&nbsp;ce que l&#8217;on veut faire&nbsp;&raquo;, nous allons utiliser la commande sed:</p>
<ul>
<li>L&#8217;option &laquo;&nbsp;-i&nbsp;&raquo; permet une modification du fichier courant</li>
<li>L&#8217;expression suivante indique ce que l&#8217;on souhaite faire, elle se découpe en 4 et est encadré par des simples quotes &laquo;&nbsp;&#8216;&nbsp;&raquo;:</li>
<ol>
<li>le &laquo;&nbsp;s&nbsp;&raquo; indique substitute: de ce fait on va remplacer toutes les occurences d&#8217;une expression par une autre</li>
<li>La chaîne de caractère après le &laquo;&nbsp;s/&nbsp;&raquo; indique qu&#8217;elle occurence nous recherchons, cela peut être une expression régulière, et elle se termine par un &laquo;&nbsp;/&nbsp;&raquo;*</li>
<li>La chaîne de caractère suivante (après le deuxième &laquo;&nbsp;/&nbsp;&raquo;) indique quelle chaîne de caractère remplacera l&#8217;occurence trouver et elle se termine par un &laquo;&nbsp;/&nbsp;&raquo;*</li>
<li>Le &laquo;&nbsp;g&nbsp;&raquo; indique que l&#8217;on procède à un remplacement global</li>
</ol>
</ul>
<p>Ce qui nous donne la ligne de commande:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">'s/SEARCH/REPLACE/g'</span></pre></div></div>

<p>Si nous mettons les deux commandes bout à bout sans oublier le pipe &laquo;&nbsp;|&nbsp;&raquo; cela nous donne donc:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-print0</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">'s/SEARCH/REPLACE/g'</span></pre></div></div>

<p>* Dans sed (et beaucoup d&#8217;autres programmes) le caractère &laquo;&nbsp;\&nbsp;&raquo; est le caractère d&#8217;échappement pour les caractères spéciaux tel que &laquo;&nbsp;/&nbsp;&raquo;, &laquo;&nbsp;@&nbsp;&raquo;, &laquo;&nbsp;$&nbsp;&raquo;, &#8230;. De ce fait si vous recherchez une chaîne contenant le caractère &laquo;&nbsp;/&nbsp;&raquo; il faudra saisir &laquo;&nbsp;\/&nbsp;&raquo; pour que celui-ci ne soit pas interprêté.</p>
<p>Voici à présent ce que cela donne lorsqu&#8217;on souhaite remplacer la chaîne de caractère &laquo;&nbsp;redmine.bilboplanet.com&nbsp;&raquo; par &laquo;&nbsp;chili.kiwais.com/projects/bilboplanet&nbsp;&raquo; (en n&#8217;oubliant pas le caractère d&#8217;échappement)*:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-print0</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">'s/redmine.bilboplanet.com/http:\/\/chili.kiwais.com\/projects\/bilboplanet/g'</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.guiona.com/2012/01/recherche-et-remplacement-recursif/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comment supprimer le caractère ^M avec vi</title>
		<link>http://blog.guiona.com/2011/12/comment-supprimer-le-caractere-m-avec-vi/</link>
		<comments>http://blog.guiona.com/2011/12/comment-supprimer-le-caractere-m-avec-vi/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 09:50:08 +0000</pubDate>
		<dc:creator>Gu!oN@*</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[ksh]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[sh]]></category>
		<category><![CDATA[vi]]></category>

		<guid isPermaLink="false">http://blog.guiona.com/?p=564</guid>
		<description><![CDATA[Lorsqu&#8217;un fichier est édité sur un system Windows/DOS à la fin de chaque ligne le caractère &#171;&#160;^M&#160;&#187; apparaît. Si vous souhaitez supprimer ce caractère sur l&#8217;ensemble du fichier avec l&#8217;éditeur vi voici la commande a utilisée: :%s/^M//g Si vous saisissez directement les caractères cela ne fonctionnera pas, pour pallier à ce problème il faut utiliser [...]]]></description>
			<content:encoded><![CDATA[<p>Lorsqu&#8217;un fichier est édité sur un system Windows/DOS à la fin de chaque ligne le caractère &laquo;&nbsp;^M&nbsp;&raquo; apparaît.</p>
<p>Si vous souhaitez supprimer ce caractère sur l&#8217;ensemble du fichier avec l&#8217;éditeur vi voici la commande a utilisée:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span>^M<span style="color: #000000; font-weight: bold;">//</span>g</pre></div></div>

<p>Si vous saisissez directement les caractères cela ne fonctionnera pas, pour pallier à ce problème il faut utiliser les combinaisons de touches suivantes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>ctrl+V<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>ctrl+M<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">//</span>g</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.guiona.com/2011/12/comment-supprimer-le-caractere-m-avec-vi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl: Couper les lignes d&#8217;un fichier a un nombre de caractères définis</title>
		<link>http://blog.guiona.com/2011/10/perl-couper-les-lignes-dun-fichier-a-un-nombre-de-caracteres-definis/</link>
		<comments>http://blog.guiona.com/2011/10/perl-couper-les-lignes-dun-fichier-a-un-nombre-de-caracteres-definis/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 09:42:06 +0000</pubDate>
		<dc:creator>Gu!oN@*</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[carriage return]]></category>
		<category><![CDATA[lf]]></category>
		<category><![CDATA[saut de ligne]]></category>

		<guid isPermaLink="false">http://blog.guiona.com/?p=555</guid>
		<description><![CDATA[Ceci n&#8217;est pas un article proprement dit, il est question d&#8217;une astuce afin de découper les lignes d&#8217;un fichier à un nombre de caractères définis avec une commande Perl et d&#8217;une simple expression régulière. On considère un fichier en entrée dont le marqueur de fin de ligne (LF) n&#8217;est pas présent et nous souhaitons le [...]]]></description>
			<content:encoded><![CDATA[<p>Ceci n&#8217;est pas un article proprement dit, il est question d&#8217;une astuce afin de découper les lignes d&#8217;un fichier à un nombre de caractères définis avec une commande Perl et d&#8217;une simple expression régulière.</p>
<p>On considère un fichier en entrée dont le marqueur de fin de ligne (LF) n&#8217;est pas présent et nous souhaitons le mettre en place chaque 20 caractères par exemple.</p>
<p>Le fichier en entrée se nommant input:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Ceci est un fichier de tests dont le caractère de fin de ligne est manquant et nous souhaitons decouper le fichier chaque 20 caractères. Pour cela nous allons utiliser Perl.</pre></div></div>

<pre>

La commande Perl:
</pre>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-0777</span> <span style="color: #660033;">-pe</span> <span style="color: #ff0000;">'s/(.{20})/\1\n/sg'</span> input</pre></div></div>

<p>Le résultat:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Ceci est un fichier
de tests dont le car
actère de fin de lig
ne est manquant et n
ous souhaitons decou
per le fichier chaqu
e 20 caractères. Pou
r cela nous allons u
tiliser Perl.</pre></div></div>

<p>Si l&#8217;on souhaite mettre en place les marqueurs CR et LF la commande devient:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-0777</span> <span style="color: #660033;">-pe</span> <span style="color: #ff0000;">'s/(.{20})/\1\r\n/sg'</span> input</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.guiona.com/2011/10/perl-couper-les-lignes-dun-fichier-a-un-nombre-de-caracteres-definis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comment renommer une carte ethernet sous Linux?</title>
		<link>http://blog.guiona.com/2011/10/linux-renommer-une-carte-ethernet/</link>
		<comments>http://blog.guiona.com/2011/10/linux-renommer-une-carte-ethernet/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 13:00:43 +0000</pubDate>
		<dc:creator>Gu!oN@*</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[Réseau]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[planet-libre]]></category>
		<category><![CDATA[eth0]]></category>
		<category><![CDATA[ifconfig]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[network-script]]></category>
		<category><![CDATA[réseau]]></category>
		<category><![CDATA[rules]]></category>
		<category><![CDATA[udev]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://blog.guiona.com/?p=522</guid>
		<description><![CDATA[Le but de cet article est de décrire la marche à suivre pour renommer une interface ethernet sur un système Linux disposant de Udev. Toutes les actions réalisées dans cet article sont faites dans le contexte &#171;&#160;root&#160;&#187; ou travers de &#171;&#160;sudo&#160;&#187; et en connexion console directe. Description: Lorsqu&#8217;on rajoute une nouvelle interface réseau sur un [...]]]></description>
			<content:encoded><![CDATA[<p>Le but de cet article est de décrire la marche à suivre pour renommer une interface ethernet sur un système Linux disposant de <a href="http://en.wikipedia.org/wiki/Udev" target="_blank">Udev</a>.</p>
<p>Toutes les actions réalisées dans cet article sont faites dans le contexte &laquo;&nbsp;root&nbsp;&raquo; ou travers de &laquo;&nbsp;sudo&nbsp;&raquo; et en connexion console directe.</p>
<p><h3>Description:</h3>
<p>Lorsqu&#8217;on rajoute une nouvelle interface réseau sur un serveur celle-ci est nommée ethN où N correspond à un chiffre incrémental.<br />
Il en est de même lorsqu&#8217;on remplace la carte réseau existante car le système connaît eth0 avec son adresse MAC personnelle (et unique) de ce fait s&#8217;il détecte une nouvelle adresse MAC il va créer une nouvelle interface même si la première n&#8217;existe plus.</p>
<p>NB: Cela s&#8217;applique également lors d&#8217;un clone VMWare
</p>
<p><h3>Mais pourquoi cela?</h3>
<p>Tout simplement car le gestionnaire de périphérique Udev garde la configuration des périphériques dans des fichiers de configurations.<br />
Pour les cartes réseaux il s&#8217;agit du fichier &laquo;&nbsp;/etc/udev/rules.d/70-persistent-net.rules&nbsp;&raquo;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># This file was automatically generated by the /lib/udev/write_net_rules</span>
<span style="color: #666666; font-style: italic;"># program, run by the persistent-net-generator.rules rules file.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># You can modify it, as long as you keep each rule on a single</span>
<span style="color: #666666; font-style: italic;"># line, and change only the value of the NAME= key.</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># PCI device 0x8086:0x100f (e1000) (custom name provided by external tool)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">ACTION</span>==<span style="color: #ff0000;">&quot;add&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTR<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:50:56:96:00:13&quot;</span>, ATTR<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">type</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;1&quot;</span>, <span style="color: #007800;">KERNEL</span>==<span style="color: #ff0000;">&quot;eth*&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth0&quot;</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">ACTION</span>==<span style="color: #ff0000;">&quot;add&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTR<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:50:56:96:01:19&quot;</span>, ATTR<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">type</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;1&quot;</span>, <span style="color: #007800;">KERNEL</span>==<span style="color: #ff0000;">&quot;eth*&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth1&quot;</span></pre></div></div>

<p>Ici on voit que le système connaît deux interfaces réseaux:</p>
<ol>
<li>eth0 avec l&#8217;adresse MAC 00:50:56:96:00:13</li>
<li>eth1 avec l&#8217;adresse MAC 00:50:56:96:01:19</li>
</ol>
<p><h3>Mode opératoire</h3>
<p>Si l&#8217;on souhaite que la carte réseau avec l&#8217;adresse MAC 00:50:56:96:01:19 se nomme eth0 il faut modifier le champs &laquo;&nbsp;NAME&nbsp;&raquo; et modifier également le champs &laquo;&nbsp;NAME&nbsp;&raquo; de l&#8217;interface se nommant, à l&#8217;instant T, eth0 ou carrément supprimer la ligne correspondante:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># This file was automatically generated by the /lib/udev/write_net_rules</span>
<span style="color: #666666; font-style: italic;"># program, run by the persistent-net-generator.rules rules file.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># You can modify it, as long as you keep each rule on a single</span>
<span style="color: #666666; font-style: italic;"># line, and change only the value of the NAME= key.</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># PCI device 0x8086:0x100f (e1000) (custom name provided by external tool)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">ACTION</span>==<span style="color: #ff0000;">&quot;add&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTR<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:50:56:96:01:19&quot;</span>, ATTR<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">type</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;1&quot;</span>, <span style="color: #007800;">KERNEL</span>==<span style="color: #ff0000;">&quot;eth*&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth0&quot;</span></pre></div></div>

</p>
<p>
Une fois notre fichier de configuration modifier il faut redémarrer le daemon &laquo;&nbsp;udevd&nbsp;&raquo;:</p>
<ul>
<li>Sur un système Debian:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ service udev restart
Stopping the hotplug events dispatcher: udevd.
Starting the hotplug events dispatcher: udevd.</pre></div></div>

<li>Sous Rhel:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ start_udev
Starting udev:                                             <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

</ul>
<p>
A cet instant notre configuration des périphériques est bonne mais la machine n&#8217;est pas sur le réseau!!!<br />
Pour cela il faut modifier le fichier de configuration de l&#8217;interface réseau &laquo;&nbsp;/etc/sysconfig/network-scripts/ifcfg-eth0&#8243; en mettant à jour l&#8217;adresse MAC (champs HWADDR) avec celle ce la nouvelle interface:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">DEVICE</span>=eth0
<span style="color: #007800;">NM_CONTROLLED</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">ONBOOT</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">TYPE</span>=Ethernet
<span style="color: #007800;">BOOTPROTO</span>=none
<span style="color: #007800;">DEFROUTE</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">PEERROUTES</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">IPV4_FAILURE_FATAL</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">IPV6INIT</span>=no
<span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;System eth0&quot;</span>
<span style="color: #007800;">IPADDR</span>=192.168.1.10
<span style="color: #007800;">NETMASK</span>=255.255.255.0
<span style="color: #007800;">DNS2</span>=192.168.1.2
<span style="color: #007800;">GATEWAY</span>=192.168.1.254
<span style="color: #007800;">DNS1</span>=192.168.1.1
<span style="color: #007800;">USERCTL</span>=no
<span style="color: #007800;">HWADDR</span>=00:<span style="color: #000000;">50</span>:<span style="color: #000000;">56</span>:<span style="color: #000000;">96</span>:00:<span style="color: #000000;">13</span></pre></div></div>

<p>Devient:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">DEVICE</span>=eth0
<span style="color: #007800;">NM_CONTROLLED</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">ONBOOT</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">TYPE</span>=Ethernet
<span style="color: #007800;">BOOTPROTO</span>=none
<span style="color: #007800;">DEFROUTE</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">PEERROUTES</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">IPV4_FAILURE_FATAL</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">IPV6INIT</span>=no
<span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;System eth0&quot;</span>
<span style="color: #007800;">IPADDR</span>=192.168.1.10
<span style="color: #007800;">NETMASK</span>=255.255.255.0
<span style="color: #007800;">DNS2</span>=192.168.1.2
<span style="color: #007800;">GATEWAY</span>=192.168.1.254
<span style="color: #007800;">DNS1</span>=192.168.1.1
<span style="color: #007800;">USERCTL</span>=no
<span style="color: #007800;">HWADDR</span>=00:<span style="color: #000000;">50</span>:<span style="color: #000000;">56</span>:<span style="color: #000000;">96</span>:01:<span style="color: #000000;">19</span></pre></div></div>

</p>
<p>
Une fois fait, on redémarre le service réseau:</p>
<ul>
<li>Sur un système Debian:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>networking restart</pre></div></div>

<li>Sous Rhel:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ service network restart</pre></div></div>

<p>Notre serveur est à présent à nouveau sur le réseau avec la nouvelle interface réseau:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ifconfig</span> eth0
eth0      Link encap:Ethernet  HWaddr 00:<span style="color: #000000;">50</span>:<span style="color: #000000;">56</span>:<span style="color: #000000;">96</span>:01:<span style="color: #000000;">19</span>
          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:<span style="color: #000000;">1500</span>  Metric:<span style="color: #000000;">1</span>
          RX packets:<span style="color: #000000;">617</span> errors:<span style="color: #000000;">0</span> dropped:<span style="color: #000000;">0</span> overruns:<span style="color: #000000;">0</span> frame:<span style="color: #000000;">0</span>
          TX packets:<span style="color: #000000;">518</span> errors:<span style="color: #000000;">0</span> dropped:<span style="color: #000000;">0</span> overruns:<span style="color: #000000;">0</span> carrier:<span style="color: #000000;">0</span>
          collisions:<span style="color: #000000;">0</span> txqueuelen:<span style="color: #000000;">1000</span>
          RX bytes:<span style="color: #000000;">55550</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">54.2</span> KiB<span style="color: #7a0874; font-weight: bold;">&#41;</span>  TX bytes:<span style="color: #000000;">90797</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">88.6</span> KiB<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.guiona.com/2011/10/linux-renommer-une-carte-ethernet/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Au revoir Dennis Ritchie aka dmr</title>
		<link>http://blog.guiona.com/2011/10/au-revoir-dennis-ritchie-aka-dmr/</link>
		<comments>http://blog.guiona.com/2011/10/au-revoir-dennis-ritchie-aka-dmr/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 07:38:31 +0000</pubDate>
		<dc:creator>Gu!oN@*</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[actualité]]></category>

		<guid isPermaLink="false">http://blog.guiona.com/?p=520</guid>
		<description><![CDATA[Aujourd&#8217;hui un homme emblématique du monde Unix nous a quitté Denis Ritchie, il n&#8217;en était pas moins que le créateur tout comme le langage C. Je ne vais pas faire de long discours car suis très mauvais dans cet exercice, je tenais juste à lui rendre hommage et à le remercier pour le travail effectué [...]]]></description>
			<content:encoded><![CDATA[<p>Aujourd&#8217;hui un homme emblématique du monde Unix nous a quitté <a href="http://en.wikipedia.org/wiki/Dennis_Ritchie">Denis Ritchie</a>, il n&#8217;en était pas moins que le créateur tout comme le langage C.</p>
<p>Je ne vais pas faire de long discours car suis très mauvais dans cet exercice, je tenais juste à lui rendre hommage et à le remercier pour le travail effectué tout au long de sa carrière.</p>
<p>Paix à son âme.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.guiona.com/2011/10/au-revoir-dennis-ritchie-aka-dmr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Unity: Purger l&#8217;historique des fichiers et dossiers</title>
		<link>http://blog.guiona.com/2011/08/ubuntu-unity-purger-lhistorique-des-fichier-et-dossiers/</link>
		<comments>http://blog.guiona.com/2011/08/ubuntu-unity-purger-lhistorique-des-fichier-et-dossiers/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 08:00:17 +0000</pubDate>
		<dc:creator>Gu!oN@*</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[historique]]></category>
		<category><![CDATA[ubntu]]></category>
		<category><![CDATA[Unity]]></category>

		<guid isPermaLink="false">http://blog.guiona.com/?p=510</guid>
		<description><![CDATA[Sous Unity, la purge de l&#8217;historique des fichiers consultés n&#8217;est pas aussi facile que sous Gnome avec son simple clic sur &#171;&#160;Clear Recents Documents&#160;&#187;. Alors comment faire? Tout se passe dans un terminal en deux lignes de commandes: Supprimer le fichier &#171;&#160;.local/share/zeitgeist/activity.sqlite&#160;&#187; de votre home directory: $ rm -f ~/.local/share/zeitgeist/activity.sqlite Réinitialiser le daemon zeitgeist*: $ [...]]]></description>
			<content:encoded><![CDATA[<p>Sous Unity, la purge de l&#8217;historique des fichiers consultés n&#8217;est pas aussi facile que sous Gnome avec son simple clic sur &laquo;&nbsp;Clear Recents Documents&nbsp;&raquo;.</p>
<p>Alors comment faire?</p>
<p>Tout se passe dans un terminal en deux lignes de commandes:</p>
<ol>
<li>Supprimer le fichier &laquo;&nbsp;.local/share/zeitgeist/activity.sqlite&nbsp;&raquo; de votre home directory:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>zeitgeist<span style="color: #000000; font-weight: bold;">/</span>activity.sqlite</pre></div></div>

<li>Réinitialiser le daemon zeitgeist*:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ zeitgeist-daemon <span style="color: #660033;">--replace</span></pre></div></div>

</ol>
<p>* zeitgeist est un framework de journalisation livré par défaut avec Natty pour plus de détails je vous renvois sur la page <a href="http://en.wikipedia.org/wiki/Zeitgeist_%28framework%29">Wikipedia</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.guiona.com/2011/08/ubuntu-unity-purger-lhistorique-des-fichier-et-dossiers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell script : Comment connaître le nombre de jour dans un mois?</title>
		<link>http://blog.guiona.com/2011/05/shell-script-comment-connaitre-le-nombre-de-jour-dans-un-mois/</link>
		<comments>http://blog.guiona.com/2011/05/shell-script-comment-connaitre-le-nombre-de-jour-dans-un-mois/#comments</comments>
		<pubDate>Sun, 22 May 2011 13:00:43 +0000</pubDate>
		<dc:creator>Gu!oN@*</dc:creator>
				<category><![CDATA[AIX]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[ksh]]></category>
		<category><![CDATA[sh]]></category>
		<category><![CDATA[calendrier]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://blog.guiona.com/?p=373</guid>
		<description><![CDATA[Ceci est une astuce plus qu&#8217;un article mais elle peut être utile dans le cadre d&#8217;un shell script. On va utiliser le binaire &#171;&#160;cal&#160;&#187; qui, lorsqu&#8217;on l&#8217;utilise tout seul, génère dans un terminal un calendrier du mois courant: $ cal février 2011 dim lun mar mer jeu ven sam 1 2 3 4 5 6 [...]]]></description>
			<content:encoded><![CDATA[<p>Ceci est une astuce plus qu&#8217;un article mais elle peut être utile dans le cadre d&#8217;un shell script.</p>
<p>On va utiliser le binaire &laquo;&nbsp;cal&nbsp;&raquo; qui, lorsqu&#8217;on l&#8217;utilise tout seul, génère dans un terminal un calendrier du mois courant:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cal</span>
       février <span style="color: #000000;">2011</span>
dim lun mar mer jeu ven sam
         <span style="color: #000000;">1</span>   <span style="color: #000000;">2</span>   <span style="color: #000000;">3</span>   <span style="color: #000000;">4</span>   <span style="color: #000000;">5</span>
 <span style="color: #000000;">6</span>   <span style="color: #000000;">7</span>   <span style="color: #000000;">8</span>   <span style="color: #000000;">9</span>  <span style="color: #000000;">10</span>  <span style="color: #000000;">11</span>  <span style="color: #000000;">12</span>
<span style="color: #000000;">13</span>  <span style="color: #000000;">14</span>  <span style="color: #000000;">15</span>  <span style="color: #000000;">16</span>  <span style="color: #000000;">17</span>  <span style="color: #000000;">18</span>  <span style="color: #000000;">19</span>
<span style="color: #000000;">20</span>  <span style="color: #000000;">21</span>  <span style="color: #000000;">22</span>  <span style="color: #000000;">23</span>  <span style="color: #000000;">24</span>  <span style="color: #000000;">25</span>  <span style="color: #000000;">26</span>
<span style="color: #000000;">27</span>  <span style="color: #000000;">28</span></pre></div></div>

<p>Une fois que l&#8217;on a le calendrier il nous suffit de l&#8217;exploiter en commençant par retirer les caractères alphabétiques:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cal</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'[a-zA-Z]'</span>
         <span style="color: #000000;">1</span>   <span style="color: #000000;">2</span>   <span style="color: #000000;">3</span>   <span style="color: #000000;">4</span>   <span style="color: #000000;">5</span>
 <span style="color: #000000;">6</span>   <span style="color: #000000;">7</span>   <span style="color: #000000;">8</span>   <span style="color: #000000;">9</span>  <span style="color: #000000;">10</span>  <span style="color: #000000;">11</span>  <span style="color: #000000;">12</span>
<span style="color: #000000;">13</span>  <span style="color: #000000;">14</span>  <span style="color: #000000;">15</span>  <span style="color: #000000;">16</span>  <span style="color: #000000;">17</span>  <span style="color: #000000;">18</span>  <span style="color: #000000;">19</span>
<span style="color: #000000;">20</span>  <span style="color: #000000;">21</span>  <span style="color: #000000;">22</span>  <span style="color: #000000;">23</span>  <span style="color: #000000;">24</span>  <span style="color: #000000;">25</span>  <span style="color: #000000;">26</span>
<span style="color: #000000;">27</span>  <span style="color: #000000;">28</span></pre></div></div>

<p>L&#8217;étape suivante consiste maintenant à compter le nombre de mots:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cal</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'[a-zA-Z]'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-w</span>
      <span style="color: #000000;">28</span></pre></div></div>

<p>Maintenant, si vous souhaitez rendre exploitable cette valeur dans un script il suffit de définir une variable de type entier (integer) dans laquelle vous stockez le résultat de la commande:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">typeset</span> <span style="color: #660033;">-i</span> <span style="color: #007800;">NB_DAYS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cal</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'[a-zA-Z]'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -w<span style="color: #7a0874; font-weight: bold;">&#41;</span>
$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #800000;">${NB_DAYS}</span>
<span style="color: #000000;">28</span></pre></div></div>

<p>Nous venons de voir comment faire pour le mois courant maintenant pour un mois spécifique il suffit de spécifier quel mois on désire (en numérique) et quelle année:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">typeset</span> <span style="color: #660033;">-i</span> <span style="color: #007800;">NB_DAYS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cal</span> <span style="color: #000000;">6</span> <span style="color: #000000;">2011</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'[a-zA-Z]'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -w<span style="color: #7a0874; font-weight: bold;">&#41;</span>
$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #800000;">${NB_DAYS}</span>
<span style="color: #000000;">30</span></pre></div></div>

<p>ou</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">typeset</span> <span style="color: #660033;">-i</span> <span style="color: #007800;">NB_DAYS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cal</span> <span style="color: #000000;">6</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'[a-zA-Z]'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -w<span style="color: #7a0874; font-weight: bold;">&#41;</span>
$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #800000;">${NB_DAYS}</span>
<span style="color: #000000;">30</span></pre></div></div>

<p>Si vous souhaitez pousser un peu plus le vice on peut imaginer travailler avec une fonction dans un script se nommant &laquo;&nbsp;test.sh&nbsp;&raquo;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/sh</span>
<span style="color: #000000; font-weight: bold;">function</span> day_in_month <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #800000;">${1}</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #660033;">-n</span> <span style="color: #800000;">${2}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #007800;">month</span>=<span style="color: #800000;">${1}</span>
                <span style="color: #007800;">year</span>=<span style="color: #800000;">${2}</span>
        <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #7a0874; font-weight: bold;">eval</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #ff0000;">&quot;+month=%m year=%Y&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
        <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cal</span> <span style="color: #800000;">${month}</span> <span style="color: #800000;">${year}</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'[a-zA-Z]'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -w<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Mois?&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> check_month
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Annee?&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> check_year
&nbsp;
day_in_month <span style="color: #800000;">${check_month}</span> <span style="color: #800000;">${check_year}</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>Si on l&#8217;execute:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ .<span style="color: #000000; font-weight: bold;">/</span>test.sh
Mois?
<span style="color: #000000;">2</span>
Annee?
<span style="color: #000000;">2012</span>
Le mois <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2012</span> compte <span style="color: #000000;">29</span> jours.</pre></div></div>

<p>Petite astuce en suivant: Comment récupérer le dernier Samedi du mois:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cal</span> 02 <span style="color: #000000;">2012</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $6 }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'^$'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-1</span>
<span style="color: #000000;">25</span></pre></div></div>

<p>ou</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cal</span> 02 <span style="color: #000000;">2012</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $6 }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'^$'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'$!d'</span>
<span style="color: #000000;">25</span></pre></div></div>

<p>ou encore</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cal</span> 02 <span style="color: #000000;">2012</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $6 }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'NF{ s=$0 } END { print s }'</span>
<span style="color: #000000;">25</span></pre></div></div>

<p>En espérant que cette petite astuce pourra vous aider.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.guiona.com/2011/05/shell-script-comment-connaitre-le-nombre-de-jour-dans-un-mois/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Grub Customizer &#8211; Un outil graphique pour configurer grub2</title>
		<link>http://blog.guiona.com/2011/05/grub-customizer-un-outil-graphique-pour-configurer-grub2/</link>
		<comments>http://blog.guiona.com/2011/05/grub-customizer-un-outil-graphique-pour-configurer-grub2/#comments</comments>
		<pubDate>Sat, 21 May 2011 20:00:02 +0000</pubDate>
		<dc:creator>Gu!oN@*</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[planet-libre]]></category>
		<category><![CDATA[boot loader]]></category>
		<category><![CDATA[grub-customizer]]></category>
		<category><![CDATA[grub2]]></category>

		<guid isPermaLink="false">http://blog.guiona.com/?p=450</guid>
		<description><![CDATA[Aujourd&#8217;hui nous partons à la découverte d&#8217;un utilitaire fort sympathique pour tout ceux qui ont peur de jouer avec la configuration de Grub. &#160; Présentation Cet utilitaire se nomme &#171;&#160;Grub Customizer&#160;&#187;, il est écrit en C++ sous licence GNU GPL v3 par Daniel Richter. Il vous permettra au travers d&#8217;une simple interface graphique de configurer [...]]]></description>
			<content:encoded><![CDATA[<p>Aujourd&#8217;hui nous partons à la découverte d&#8217;un utilitaire fort sympathique pour tout ceux qui ont peur de jouer avec la configuration de <a href="http://www.gnu.org/software/grub/" target="_blank">Grub</a>.</p>
<p>&nbsp;</p>
<h2>Présentation</h2>
<p>Cet utilitaire se nomme &laquo;&nbsp;Grub Customizer&nbsp;&raquo;, il est écrit en C++ sous licence <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GNU GPL v3</a> par <a href="https://launchpad.net/~danielrichter2007" target="_blank">Daniel Richter</a>.<br />
Il vous permettra au travers d&#8217;une simple interface graphique de configurer votre chargeur de démarrage (boot loader) en toute sérénité.</p>
<p>&nbsp;</p>
<h2>Installation</h2>
<p></p>
<h3>Installation depuis les sources</h3>
<p>A l&#8217;instant où j&#8217;écris cet article, la version publiée est 2.1.2.<br />
Celle-ci est  disponible en téléchargement sur la page launchpad du projet: <a href="https://launchpad.net/grub-customizer" target="_blank">https://launchpad.net/grub-customizer</a> (<a href="http://launchpad.net/grub-customizer/2.1/2.1.2/+download/grub-customizer_2.1.2.tar.gz">lien direct</a>).<br />
Pour pouvoir installer depuis les sources, il vous faudra disposer des près-requis suivants:</p>
<ul>
<li>libgtkmm-2.4-dev</li>
<li>cmake</li>
<li>make</li>
<li>gcc</li>
</ul>
<p>Généralement ces paquets sont disponibles dans les dépôts de vos distributions.<br />
Une fois les près-requis installés et l&#8217;archive téléchargée nous pouvons passer à l&#8217;installation:</p>
<ul>
<li>Extraire les sources:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>grub-customizer_2.1.2
$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>grub-customizer_2.1.2
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>launchpad.net<span style="color: #000000; font-weight: bold;">/</span>grub-customizer<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2.1</span><span style="color: #000000; font-weight: bold;">/</span>2.1.2<span style="color: #000000; font-weight: bold;">/</span>+download<span style="color: #000000; font-weight: bold;">/</span>grub-customizer_2.1.2.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> grub-customizer_2.1.2.tar.gz</pre></div></div>

<li>Compilation:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ cmake .
$ <span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

<li>Installation:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

</ul>
<h3>Installation Ubuntu</h3>
<p>Il est possible d&#8217;installer le paquet directement sous Ubuntu:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> add-apt-repository ppa:danielrichter2007<span style="color: #000000; font-weight: bold;">/</span>grub-customizer
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> grub-customizer</pre></div></div>

<p>&nbsp;</p>
<h2>Lancement</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> grub-customizer</pre></div></div>

<p>A partir de cette interface vous allez pouvoir activer et/ou désactiver des entrées dans le menu Grub:<br />
<center><a href="http://blog.guiona.com/wp-content/uploads/2011/05/Grub-Customizer.png"><img src="http://blog.guiona.com/wp-content/uploads/2011/05/Grub-Customizer-300x234.png" alt="" title="Grub-Customizer" width="300" height="234" class="alignnone size-medium wp-image-464" /></a></center></p>
<p>Si vous cliquez sur &laquo;&nbsp;Preferences&nbsp;&raquo; vous allez pouvoir personnaliser votre menu:</p>
<ul>
<li>Doit-on le voir ou pas?</li>
<li>Si on le voit alors pendant combien de temps?</li>
<li>Modifier les paramètres d&#8217;affichages (couleur, résolution, &#8230;)</li>
<li>etc&#8230;</li>
</ul>
<p><a href="http://blog.guiona.com/wp-content/uploads/2011/05/Grub-Customizer-settings-general.png"><img src="http://blog.guiona.com/wp-content/uploads/2011/05/Grub-Customizer-settings-general-150x150.png" alt="" title="Grub Customizer - settings-general" width="150" height="150" class="alignnone size-thumbnail wp-image-496" /></a><a href="http://blog.guiona.com/wp-content/uploads/2011/05/Grub-Customizer-settings-appearance.png"><img src="http://blog.guiona.com/wp-content/uploads/2011/05/Grub-Customizer-settings-appearance-150x150.png" alt="" title="Grub Customizer - settings-appearance" width="150" height="150" class="alignnone size-thumbnail wp-image-497" /></a><a href="http://blog.guiona.com/wp-content/uploads/2011/05/Grub-Customizer-settings-advanced.png"><img src="http://blog.guiona.com/wp-content/uploads/2011/05/Grub-Customizer-settings-advanced-150x150.png" alt="" title="Grub Customizer - settings-advanced" width="150" height="150" class="alignnone size-thumbnail wp-image-498" /></a></p>
<p>Une fois que vous avez ajusté votre configuration, il suffit de cliquer sur &laquo;&nbsp;Save&nbsp;&raquo; et tout sera automatiquement fait.<br />
Il n&#8217;est plus nécessaire de lancer &laquo;&nbsp;update-grub2&#8243;.</p>
<p>Nous constatons que l&#8217;utilisation de cet outil est relativement simple, mais il faut de même faire attention à ce que l&#8217;on fait!</p>
<p>Pour de plus amples informations je vous invite à lire la <a href="https://answers.launchpad.net/grub-customizer/+faq/1355">FAQ</a> (anglais).</p>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>Je trouve cet utilitaire fort intéressant pour tout ceux qui ont peur de modifier directement les fichiers de configurations (petit rappel: il faut toujours faire une copie de sauvegarde avant toute modification d&#8217;un fichier).<br />
Il permet de présenter simplement les possibilités que peut offrir Grub2 en termes de configuration et de personnalisation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.guiona.com/2011/05/grub-customizer-un-outil-graphique-pour-configurer-grub2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ubuntu Natty: Unity ne se lance pas?</title>
		<link>http://blog.guiona.com/2011/05/ubuntu-natty-unity-ne-se-lance-pas/</link>
		<comments>http://blog.guiona.com/2011/05/ubuntu-natty-unity-ne-se-lance-pas/#comments</comments>
		<pubDate>Sat, 21 May 2011 16:00:23 +0000</pubDate>
		<dc:creator>Gu!oN@*</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[planet-libre]]></category>
		<category><![CDATA[nvidia]]></category>
		<category><![CDATA[Unity]]></category>

		<guid isPermaLink="false">http://blog.guiona.com/?p=397</guid>
		<description><![CDATA[Récement lors de l&#8217;installation d&#8217;une Ubuntu NattyNarwhal 64 bits afin de tester la nouvelle interface Unity j&#8217;ai rencontré un problème bloquant: impossible de démarrer Unity. Un peu génant vous en conviendrez&#8230; A l&#8217;ouverture de session j&#8217;obtenais le message d&#8217;erreur suivant: Un petit coup d&#8217;oeil sur la page des près-requis matériel: ça semble convenir! Pour vérifier [...]]]></description>
			<content:encoded><![CDATA[<p>Récement lors de l&#8217;installation d&#8217;une <a href="https://wiki.ubuntu.com/NattyNarwhal">Ubuntu NattyNarwhal</a> 64 bits afin de tester la nouvelle interface <a href="http://unity.ubuntu.com/">Unity</a> j&#8217;ai rencontré un problème bloquant: impossible de démarrer Unity. Un peu génant vous en conviendrez&#8230; A l&#8217;ouverture de session j&#8217;obtenais le message d&#8217;erreur suivant:<br />
<a href="http://blog.guiona.com/wp-content/uploads/2011/05/unity-error.jpg"><img src="http://blog.guiona.com/wp-content/uploads/2011/05/unity-error.jpg" alt="unity-error" title="Unity Hardware Requirement" width="479" height="149" class="alignnone size-full wp-image-399" /></a><br />
Un petit coup d&#8217;oeil sur la page des <a href="https://wiki.ubuntu.com/DesktopExperienceTeam/UnityHardwareRequirements">près-requis</a> matériel: ça semble convenir!</p>
<p>Pour vérifier un peu plus précisément ce qui bloque quant à l&#8217;utilisation de Unity, il exite un petit utilitaire: &laquo;&nbsp;/usr/lib/nux/unity_support_test&nbsp;&raquo;.</p>
<p>Pour obtenir le verdict il suffit de l&#8217;exécuter avec l&#8217;option &laquo;&nbsp;-p&nbsp;&raquo;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nux<span style="color: #000000; font-weight: bold;">/</span>unity_support_test <span style="color: #660033;">-p</span></pre></div></div>

<p>Et le résultat me donnait:<br />
<center><a href="http://blog.guiona.com/wp-content/uploads/2011/05/unity-check1.png"><img src="http://blog.guiona.com/wp-content/uploads/2011/05/unity-check1.png" alt="" title="unity-check" width="450" height="318" class="alignnone size-full wp-image-426" /></a></center></p>
<p>Cela veut dire que mon pilote graphique est blacklisté!!!<br />
Lors de mon test j&#8217;ai utilisé le pilote propriétaire Nvidia qui est &laquo;&nbsp;Testé par les développeur Ubuntu et requis pour l&#8217;utilisation de Unity&nbsp;&raquo;:<br />
<center><a href="http://blog.guiona.com/wp-content/uploads/2011/05/Unity-Additional-Drivers.png"><img src="http://blog.guiona.com/wp-content/uploads/2011/05/Unity-Additional-Drivers-279x300.png" alt="" title="Unity-Additional Drivers" width="279" height="300" class="alignnone size-medium wp-image-429" /></a></center></p>
<p>J&#8217;utilse donc le driver &laquo;&nbsp;nvidia-173&#8243;, pour m&#8217;assurer qu&#8217;il est bien blacklisté on jette un petit coup d&#8217;oeil dans le fichier &laquo;&nbsp;nvidia-graphics-drivers.conf&nbsp;&raquo;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>modprobe.d<span style="color: #000000; font-weight: bold;">/</span>nvidia-graphics-drivers.conf
blacklist nouveau
blacklist lbm-nouveau
blacklist nvidia-current
blacklist nvidia-<span style="color: #000000;">96</span></pre></div></div>

<p>NB: vous constaterez que le pilote open source &laquo;&nbsp;nouveau&nbsp;&raquo; est blacklisté&#8230;..</p>
<p>Le pilote que j&#8217;utilse n&#8217;est pas blacklisté&#8230; donc comment faire pour lancer cette nouvelle interface?<br />
Simplement en rajoutant une entrée dans le fichier &laquo;&nbsp;/etc/environment&nbsp;&raquo; afin de forcer Unity à démarrer:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>environment
<span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games&quot;</span>
<span style="color: #007800;">UNITY_FORCE_START</span>=<span style="color: #000000;">1</span></pre></div></div>

<p>Lorsque le fichier est mis à jour, on redémarre, on se connecte à l&#8217;invite gdm et miracle Unity se lance:<br />
<center><a href="http://blog.guiona.com/wp-content/uploads/2011/05/unity-desk.png"><img src="http://blog.guiona.com/wp-content/uploads/2011/05/unity-desk-300x240.png" alt="" title="unity-desk" width="300" height="240" class="alignnone size-medium wp-image-434" /></a></center></p>
<p>Attention tout de même à l&#8217;utilsation de cette variable car il est possible d&#8217;obtenir quelques effets négatifs.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.guiona.com/2011/05/ubuntu-natty-unity-ne-se-lance-pas/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>RHEL : X11 Forwarding sans serveur X</title>
		<link>http://blog.guiona.com/2011/05/rhel-x11-forwarding-sans-serveur-x/</link>
		<comments>http://blog.guiona.com/2011/05/rhel-x11-forwarding-sans-serveur-x/#comments</comments>
		<pubDate>Wed, 11 May 2011 13:00:33 +0000</pubDate>
		<dc:creator>Gu!oN@*</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[X11]]></category>
		<category><![CDATA[X11Forwarding]]></category>

		<guid isPermaLink="false">http://blog.guiona.com/?p=402</guid>
		<description><![CDATA[Si comme moi il vous arrive d&#8217;installer des machines sous Red Hat Entreprise Linux sur lesquelles vous n&#8217;installez par d&#8217;interface graphique et que pour exploiter un logiciel vous devez faire du forward X11 (au travers de votre connexion ssh) alors cet article est fait pour vous. Configuration de ssh Rien de bien compliquer, il faut [...]]]></description>
			<content:encoded><![CDATA[<p>Si comme moi il vous arrive d&#8217;installer des machines sous Red Hat Entreprise Linux sur lesquelles vous n&#8217;installez par d&#8217;interface graphique et que pour exploiter un logiciel  vous devez faire du forward X11 (au travers de votre connexion ssh) alors cet article est fait pour vous.</p>
<h2>Configuration de ssh</h2>
<p>Rien de bien compliquer, il faut tout simplement positionner la directive &laquo;&nbsp;X11Forwarding&nbsp;&raquo; à &laquo;&nbsp;yes&nbsp;&raquo; dans le fichier &laquo;&nbsp;/etc/ssh/sshd_config&nbsp;&raquo;:</p>
<blockquote><p><code><font color="red">root@rhel.guiona.com#</font><font color="black"> vi /etc/ssh/sshd_config</font><br />
[....]<br />
X11Forwarding yes<br />
[...]<br />
<font color="red">root@rhel.guiona.com#</font> <font color="black"> cat /etc/ssh/sshd_config | grep '^X11'</font><br />
X11Forwarding yes</code></p></blockquote>
<p>Une fois que cela est fait, il faut redémarrer le service ssh afin que la modification soit prise en compte:</p>
<blockquote><p><code><font color="red">root@rhel.guiona.com#</font> <font color="black">service sshd restart</font><br />
service sshd restart<br />
Stopping sshd:                                            [  <font color="green">OK</font>  ]<br />
Starting sshd:                                             [  <font color="green">OK</font>  ]<br />
</code></p></blockquote>
<h2>Installation des paquets requis</h2>
<p>Afin que le Forward X11 fonctionne il faut disposer du paquet &laquo;&nbsp;xorg-x11-xauth&nbsp;&raquo; mais celui-ci dépend du paquet &laquo;&nbsp;libXmu&nbsp;&raquo; qui dépend à son tour de &laquo;&nbsp;libXt&nbsp;&raquo;.</p>
<p>Pour installer ces paquets, deux solutions s&#8217;offrent à nous:</p>
<ul>
<li>La machine a un accès internet donc on peut utiliser &laquo;&nbsp;yum&nbsp;&raquo;</li>
<li>La machine n&#8217;a pas d&#8217;accès internet donc il faut faire une installation manuelle</li>
</ul>
<p>NB: Il y a également l&#8217;éventualité de disposer de son propre mirroir pour les paquets dans ce cas on peut également utiliser &laquo;&nbsp;yum&nbsp;&raquo;.</p>
<h3>Installation automatique</h3>
<blockquote><p><code><font color="red">root@rhel.guiona.com#</font> <font color="black">yum -y install xorg-x11-xauth</font></code></p></blockquote>
<h3>Intallation manuelle</h3>
<p>Après avoir télécharger les rpm adéquat:</p>
<blockquote><p><code><br />
<font color="red">root@rhel.guiona.com#</font> <font color="black">rpm-i xorg-x11-xauth-1.0.2-7.1.el6.x86_64.rpm</font><br />
<font color="red">root@rhel.guiona.com#</font> <font color="black">libXmu-1.0.5-1.el6.x86_64.rpm</font><br />
<font color="red">root@rhel.guiona.com#</font> <font color="black">libXt-1.0.7-1.el6.x86_64.rpm</font><br />
</code></p></blockquote>
<h2>Validation</h2>
<p>Maintenant que nous avons tout le nécessaire requis, il faut définir la variable d&#8217;environnement &laquo;&nbsp;DISPLAY&nbsp;&raquo;:</p>
<blockquote><p><code><font color="red">root@rhel.guiona.com#</font> <font color="black">export DISPLAY=X.X.X.X:Y.0</font></p>
<p>Où X.X.X.X correspond à l'adresse IP de votre client X et Y correspond au numéro d'écran.<br />
</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.guiona.com/2011/05/rhel-x11-forwarding-sans-serveur-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

