<?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=377922&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / Ne lancer qu'une fois un script]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=377922</link>
		<description><![CDATA[Les sujets les plus récents dans Ne lancer qu'une fois un script.]]></description>
		<lastBuildDate>Mon, 08 Feb 2010 20:40:14 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  Ne lancer qu'une fois un script]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3267332#p3267332</link>
			<description><![CDATA[<p>Bonjour, c&#039;est utilisé dans pas mal de programme</p><p>apt-get,synaptic (l&#039;histoire du /dkpg/lock)<br />mpd avec son fichier mpd.pid</p><p>et j&#039;en passe</p><p>Merci pour le lien sputnick</p>]]></description>
			<author><![CDATA[dummy@example.com (wido)]]></author>
			<pubDate>Mon, 08 Feb 2010 20:40:14 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3267332#p3267332</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Ne lancer qu'une fois un script]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3267306#p3267306</link>
			<description><![CDATA[<p>Moi je te remercie sputnick je connaissait pas cette méthode <img src="http://forum.ubuntu-fr.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></description>
			<author><![CDATA[dummy@example.com (n3o51)]]></author>
			<pubDate>Mon, 08 Feb 2010 20:32:02 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3267306#p3267306</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Ne lancer qu'une fois un script]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3267277#p3267277</link>
			<description><![CDATA[<p>oO </p><p>Un lock sert justement a s&#039;assurer qu&#039;une seule instance d&#039;un script est en cours d&#039;execution.<br />Un lock bien étudié est dit &quot;atomique&quot; -&gt; http://fr.wikipedia.org/wiki/Atomicit%C3%A9_%28informatique%29<br />Pour un fonctionement prévisible, optimal et fiable, c&#039;est la solution à envisager.<br />Peux etre n&#039;a tu pas besoin de choses aussi fiables, mais que les personnes qui lisent celà si, donc autant leur donner de bons conseils.</p>]]></description>
			<author><![CDATA[dummy@example.com (sputnick)]]></author>
			<pubDate>Mon, 08 Feb 2010 20:24:01 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3267277#p3267277</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Ne lancer qu'une fois un script]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3267037#p3267037</link>
			<description><![CDATA[<p>@sputnick :<br />C&#039;est n&#039;est pas un lock que je veux. Simplement, ne pas lancer deux fois la même tâche. La solution &quot;pidof&quot; me convient bien, quoique un peu &quot;obsfuscated&quot; comme code.</p><p>J&#039;ai préféré :</p><div class="codebox"><pre><code>pid=`pidof -x -o $$ ${0##*/}`
if [ -n &quot;$pid&quot; ]
then
 echo &quot;Déjà lancé&quot;
 exit
fi</code></pre></div><p>Quoique, dans l&#039;absolu, je préfère mon code, qui n&#039;interdit pas de lancer le script chez un autre utilisateur... (bon, je suis le seul utilisateur, y&#039;a pas de problème, mais pour la beauté de la chose...)</p>]]></description>
			<author><![CDATA[dummy@example.com (serged)]]></author>
			<pubDate>Mon, 08 Feb 2010 18:36:54 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3267037#p3267037</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Ne lancer qu'une fois un script]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3266700#p3266700</link>
			<description><![CDATA[<p>oO</p><p>Si vous voulez un lock digne de ce nom, un peu de doc dans la langue de Jimmy Hendrix : http://www.bash-hackers.org/wiki/doku.php/howto/mutex</p>]]></description>
			<author><![CDATA[dummy@example.com (sputnick)]]></author>
			<pubDate>Mon, 08 Feb 2010 16:19:22 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3266700#p3266700</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Ne lancer qu'une fois un script]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3266184#p3266184</link>
			<description><![CDATA[<div class="codebox"><pre><code> 
 
pidof -x -o $$ ${0##*/} &amp;&amp; exit</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (FRUiT)]]></author>
			<pubDate>Mon, 08 Feb 2010 10:15:08 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3266184#p3266184</guid>
		</item>
		<item>
			<title><![CDATA[Ne lancer qu'une fois un script]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3266152#p3266152</link>
			<description><![CDATA[<p>Pour éviter de lancer deux fois en même temps un script, j&#039;ai fait :</p><div class="codebox"><pre><code>#!/bin/bash
# Test si déjà lancé (par le même utilisateur)
res=`ps U \`whoami\`|grep -c &quot;$0&quot;`
if (( res &gt; 3 ))
then
 echo &quot;script Déjà lancé&quot;
 exit
fi
# Suite du script...</code></pre></div><p>C&#039;est bon ? Y&#039;a quelque chose qui cloche ou quelque chose de plus simple ?</p><p>Par contre je ne comprends pas pourquoi le &quot;grep -c&quot; me sort 3 et pas 2 : Il doit trouver le processus, le grep et puis c&#039;est tout ? d&#039;ailleurs si je remplace grep -c par un grep normal, il m&#039;affiche bien deux lignes...</p>]]></description>
			<author><![CDATA[dummy@example.com (serged)]]></author>
			<pubDate>Mon, 08 Feb 2010 09:57:19 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3266152#p3266152</guid>
		</item>
	</channel>
</rss>
