<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://forum.ubuntu-fr.org/extern.php?action=feed&amp;tid=1129681&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / Script Lecture Variable]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=1129681</link>
		<description><![CDATA[Les sujets les plus récents dans Script Lecture Variable.]]></description>
		<lastBuildDate>Fri, 07 Dec 2012 06:25:03 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  Script Lecture Variable]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11779021#p11779021</link>
			<description><![CDATA[<p>Il y a même plus simple, si les valeurs ne changent pas. C&#039;est de conserver le fichier modifié dans un coin, et de le copier sur l&#039;original lors du reboot.</p>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Fri, 07 Dec 2012 06:25:03 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11779021#p11779021</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Script Lecture Variable]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11777981#p11777981</link>
			<description><![CDATA[<p>Bonjour,</p><p>Merci beaucoup pingouinux ta solution fonctionne parfaitement merci encore ! ^^</p>]]></description>
			<author><![CDATA[dummy@example.com (Burstfury)]]></author>
			<pubDate>Fri, 07 Dec 2012 00:02:10 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11777981#p11777981</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Script Lecture Variable]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11777221#p11777221</link>
			<description><![CDATA[<p>Bonsoir,<br />Ce que tu veux faire, est-ce bien de remplacer les lignes 4 à 7 du second fichier (HD0=… à HD3=…) par la sortie de cette commande ?</p><div class="codebox"><pre><code>ls -l /sys/block/sd{a..d}|awk -F&quot;/&quot; &#039;{printf(&quot;HD%d=\&quot;/sys/class/scsi_host/%s/device/%s/%s\&quot;\n&quot;,NR-1,$8,$9,$10)}&#039;</code></pre></div><p><span class="bbu">Ajouté</span> :<br />Si c&#039;est bien ça, voici comment modifier ton fichier :</p><div class="codebox"><pre><code>head -3 fichier_initial &gt;fichier_modifie

ls -l /sys/block/sd{a..d}|awk -F&quot;/&quot; &#039;{printf(&quot;HD%d=\&quot;/sys/class/scsi_host/%s/device/%s/%s\&quot;\n&quot;,NR-1,$8,$9,$10)}&#039; &gt;&gt;fichier_modifie

tail -n +8 fichier_initial &gt;&gt;fichier_modifie</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Thu, 06 Dec 2012 22:06:50 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11777221#p11777221</guid>
		</item>
		<item>
			<title><![CDATA[Script Lecture Variable]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11776881#p11776881</link>
			<description><![CDATA[<p>Bonjour,</p><p>J&#039;ai un serveur NAS le hp EX470 qui par défaut est installé avec windows 2003. Comme je n’apprécie pas ce system d&#039;exploitation j&#039;ai installé ubuntu 12.04 qui fonctionne très bien. Mais il me reste un problème à réglé qui sont les leds en façade, elle me permettent de voir la santé des disques dur. </p><p>J&#039;ai trouvé un script sur le net qui me permet de les faire fonctionné, mais je dois modifier manuellement quelques lignes, car à chaque sda,sdb,sdc,sdd change.</p><p>Tout d&#039;abord pour avoir les bonnes informations je tappe la commande suivant :<br />ls -l /sys/block/sd*<br />Ca me permet de recupere cette information.</p><div class="codebox"><pre><code>lrwxrwxrwx 1 root root 0 déc.   6  2012 /sys/block/sda -&gt; ../devices/pci0000:00/0000:00:05.0/host0/target0:0:0/0:0:0:0/block/sda
lrwxrwxrwx 1 root root 0 déc.   6  2012 /sys/block/sdb -&gt; ../devices/pci0000:00/0000:00:05.0/host0/target0:0:1/0:0:1:0/block/sdb
lrwxrwxrwx 1 root root 0 déc.   6  2012 /sys/block/sdc -&gt; ../devices/pci0000:00/0000:00:05.0/host2/target2:0:0/2:0:0:0/block/sdc
lrwxrwxrwx 1 root root 0 déc.   6  2012 /sys/block/sdd -&gt; ../devices/pci0000:00/0000:00:05.0/host2/target2:0:1/2:0:1:0/block/sdd
lrwxrwxrwx 1 root root 0 déc.   6  2012 /sys/block/sde -&gt; ../devices/pci0000:00/0000:00:03.3/usb1/1-2/1-2:1.0/host4/target4:0:0/4:0:0:0/block/sde</code></pre></div><p>Et voici le script ou je dois modifier les variable HD0 HD1 HD2 HD3<br />Dans le script&#160; pour le disque dr HD0 je dois modifier le chiffre apres &quot;host&quot;&#160; je dois faire de même pour &quot;target&quot; et remplacer le &quot;3&quot; suivie des 0:0:0:0 par&#160; le chiffre &quot;0&quot; qui est le disque dur &quot;sdA&quot;, et je dois faire ca pour HD0 et HD1, alors que pour le HD3 et HD4 je dois utiliser le chiffre 2.</p><div class="codebox"><pre class="vscroll"><code>#!/bin/bash

## Here are my 4 disk paths in sysfs
HD0=&quot;/sys/class/scsi_host/host3/device/target3:0:0/3:0:0:0&quot;
HD1=&quot;/sys/class/scsi_host/host3/device/target3:0:1/3:0:1:0&quot;
HD2=&quot;/sys/class/scsi_host/host4/device/target4:0:0/4:0:0:0&quot;
HD3=&quot;/sys/class/scsi_host/host4/device/target4:0:1/4:0:1:0&quot;


## First lets check if all drives are responding to hdparm
DRIVES_OK=1
for drive in $(ls /dev/disk/by-id/ata-*|grep -v part)
do
 /sbin/hdparm -i $drive &gt;/dev/null 2&gt;&amp;1 || DRIVES_OK=0
done
if [ 0 -eq $DRIVES_OK ]
then
  # not all drives are talking with hdparm, rescan needed
  echo 0 0 0 &gt; /sys/class/scsi_host/host0/scan
  echo 0 1 0 &gt; /sys/class/scsi_host/host0/scan
  echo 0 0 0 &gt; /sys/class/scsi_host/host1/scan
  echo 0 1 0 &gt; /sys/class/scsi_host/host1/scan
fi

# set default color (faulty drive)
STATE0=red
STATE1=red
STATE2=red
STATE3=red

# check each drive using sysfs. Set LED to blue if disk is ok
if [ -f  &quot;$HD0/state&quot; ]
then
 cat &quot;$HD0/state&quot; | grep -q running &amp;&amp; STATE0=blue
fi
if [ -f  &quot;$HD1/state&quot; ]
then
 cat &quot;$HD1/state&quot; | grep -q running &amp;&amp; STATE1=blue
fi
if [ -f  &quot;$HD2/state&quot; ]
then
 cat &quot;$HD2/state&quot; | grep -q running &amp;&amp; STATE2=blue
fi
if [ -f  &quot;$HD3/state&quot; ]
then
 cat &quot;$HD3/state&quot; | grep -q running &amp;&amp; STATE3=blue
fi

# Execute the binary to update LED status &lt;img src=&quot;http://blog.sokkar.org/wp-includes/images/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;wp-smiley&quot;&gt; 
/root/bin/e47x_setleds $STATE0 $STATE1 $STATE2 $STATE3
exit 0</code></pre></div><p>Et il possible de modifier le script pour que cela ce face automatiquements ou je suis condamné à le faire la main à chaque reboot.<br />J&#039;espere avoir était le plus clair possible si vous avez besoin d&#039;autres informations pas à demander.<br />Merci beaucoup pour toute aide!.</p>]]></description>
			<author><![CDATA[dummy@example.com (Burstfury)]]></author>
			<pubDate>Thu, 06 Dec 2012 21:26:29 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11776881#p11776881</guid>
		</item>
	</channel>
</rss>
