<?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>Rodolphe Stoclin</title>
	<atom:link href="http://blog.2clics.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.2clics.net</link>
	<description>Front-End Web Developer</description>
	<lastBuildDate>Thu, 10 Mar 2011 22:01:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Les callback en Javascript et jQuery</title>
		<link>http://blog.2clics.net/2011/03/03/callback-javascript-jquery/</link>
		<comments>http://blog.2clics.net/2011/03/03/callback-javascript-jquery/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 23:04:19 +0000</pubDate>
		<dc:creator>Rodolphe Stoclin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[callback]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://blog.2clics.net/?p=55</guid>
		<description><![CDATA[<h3>Callback par l&#8217;exemple</h3>
<p>
Pour schématiser, les callback sont des &#171;&#160;retours&#160;&#187; qui sont exécutés à la fin d&#8217;une action.
</p>
<p>
Voici un exemple simple.<br />
Nous partons d&#8217;une fonction &#171;&#160;maFonction&#160;&#187;, auquel nous lui rajoutons un callback dans un 2ème&#8230; <a href="http://blog.2clics.net/2011/03/03/callback-javascript-jquery/" class="read_more">Lire la suite</a></p>]]></description>
			<content:encoded><![CDATA[<h3>Callback par l&#8217;exemple</h3>
<p>
Pour schématiser, les callback sont des &laquo;&nbsp;retours&nbsp;&raquo; qui sont exécutés à la fin d&#8217;une action.
</p>
<p>
Voici un exemple simple.<br />
Nous partons d&#8217;une fonction &laquo;&nbsp;maFonction&nbsp;&raquo;, auquel nous lui rajoutons un callback dans un 2ème temps.
</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> maFonction <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>value1<span style="color: #339933;">,</span> value2<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> value1 <span style="color: #339933;">+</span> value2<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
maFonction<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>
Qui devient :
</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> maFonction <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>value1<span style="color: #339933;">,</span> value2<span style="color: #339933;">,</span> callback<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> value1 <span style="color: #339933;">+</span> value2<span style="color: #339933;">;</span>
	callback<span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
maFonction<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// Içi un traitement à être exécutée en callback</span>
	<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>
Autre exemple, dans le cas de jQuery.<br />
Nous voulons avoir à la fin d&#8217;un effet un changement de couleur de texte :
</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#element&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2000</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// Içi notre callback</span>
	jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#element p&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;color&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;red&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>
Concernant jQuery, il est assez simple de voir si un callback existe, en vérifiant dans les docs : <a href="http://api.jquery.com/fadeIn/" onclick="return TrackClick('http%3A%2F%2Fapi.jquery.com%2FfadeIn%2F','http%3A%2F%2Fapi.jquery.com%2FfadeIn%2F')">http://api.jquery.com/fadeIn/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.2clics.net/2011/03/03/callback-javascript-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script BASH pour lancer NodeJS et MongoDB</title>
		<link>http://blog.2clics.net/2011/03/01/bash-script-nodejs-mongodb-daemon/</link>
		<comments>http://blog.2clics.net/2011/03/01/bash-script-nodejs-mongodb-daemon/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 08:00:39 +0000</pubDate>
		<dc:creator>Rodolphe Stoclin</dc:creator>
				<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[node.js]]></category>

		<guid isPermaLink="false">http://blog.2clics.net/?p=19</guid>
		<description><![CDATA[<h3>Dans cet article, nous allons voir comment créer un script de démarrage/arrêt pour NodeJS et MongoDB</h3>
<p><strong>Etape 1</strong></p>
<p>
Les variables de configuration.<br />
Modifiez ces chemins afin de les adapter à votre système.
</p>
<p>
- Les variables <span&#8230; <a href="http://blog.2clics.net/2011/03/01/bash-script-nodejs-mongodb-daemon/" class="read_more">Lire la suite</a></p>]]></description>
			<content:encoded><![CDATA[<h3>Dans cet article, nous allons voir comment créer un script de démarrage/arrêt pour NodeJS et MongoDB</h3>
<p><strong>Etape 1</strong></p>
<p>
Les variables de configuration.<br />
Modifiez ces chemins afin de les adapter à votre système.
</p>
<p>
- Les variables <span style="color: #007800;">PATH_NODEJS</span> et <span style="color: #007800;">PATH_MONGODB</span> sont les chemins vers les binaires.<br />
- <span style="color: #007800;">PATH_LOG_NODEJS</span> et <span style="color: #007800;">PATH_LOG_MONGODB</span> sont les chemins vers les fichiers de log.<br />
- La variable <span style="color: #007800;">PATH_SCRIPT_NODEJS</span> correspond à votre script de démarrage NodeJS.
</p>
<p>
Les variables <span style="color: #007800;">ID_NODEJS</span> et <span style="color: #007800;">ID_MONGODB</span> ne doivent pas être modifiées.<br />
Elles sont là pour récupérer les id des processus.
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># http://blog.2clics.net/2011/03/01/bash-script-nodejs-mongodb-daemon/</span>
&nbsp;
<span style="color: #007800;">PATH_NODEJS</span>=<span style="color: #ff0000;">&quot;/opt/local/bin/node&quot;</span>
<span style="color: #007800;">PATH_MONGODB</span>=<span style="color: #ff0000;">&quot;/opt/local/bin/mongod&quot;</span>
<span style="color: #007800;">PATH_LOG_NODEJS</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/log-N.log&quot;</span>
<span style="color: #007800;">PATH_LOG_MONGODB</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/log-M.log&quot;</span>
<span style="color: #007800;">PATH_SCRIPT_NODEJS</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/server.js&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Don't modify</span>
<span style="color: #007800;">ID_NODEJS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> ax <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> <span style="color: #ff0000;">'node'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iv</span> <span style="color: #ff0000;">'grep'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'\n'</span> <span style="color: #ff0000;">' '</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">ID_MONGODB</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> ax <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> <span style="color: #ff0000;">'mongod'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iv</span> <span style="color: #ff0000;">'grep'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'\n'</span> <span style="color: #ff0000;">' '</span><span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p><strong>Etape 2</strong></p>
<p>
On rajoute un switch avec les différents états : start/stop/restart
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># http://blog.2clics.net/2011/03/01/bash-script-nodejs-mongodb-daemon/</span>
&nbsp;
<span style="color: #007800;">PATH_NODEJS</span>=<span style="color: #ff0000;">&quot;/opt/local/bin/node&quot;</span>
<span style="color: #007800;">PATH_MONGODB</span>=<span style="color: #ff0000;">&quot;/opt/local/bin/mongod&quot;</span>
<span style="color: #007800;">PATH_LOG_NODEJS</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/log-N.log&quot;</span>
<span style="color: #007800;">PATH_LOG_MONGODB</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/log-M.log&quot;</span>
<span style="color: #007800;">PATH_SCRIPT_NODEJS</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/server.js&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Don't modify</span>
<span style="color: #007800;">ID_NODEJS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> ax <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> <span style="color: #ff0000;">'node'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iv</span> <span style="color: #ff0000;">'grep'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'\n'</span> <span style="color: #ff0000;">' '</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">ID_MONGODB</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> ax <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> <span style="color: #ff0000;">'mongod'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iv</span> <span style="color: #ff0000;">'grep'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'\n'</span> <span style="color: #ff0000;">' '</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
	start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 {start|stop|restart}&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p><strong>Etape 3</strong></p>
<p>
Le cas &laquo;&nbsp;start&nbsp;&raquo;, on vérifie tout d&#8217;abord si Node et Mongo sont lancés.<br />
Avec des conditions pour quitter le script s&#8217;ils sont déjà lancés.
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ID_NODEJS</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS is already running, stop it first!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ID_MONGODB</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;MongoDB is already running, stop it first!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>
Le contenu du &laquo;&nbsp;else&nbsp;&raquo; permet de lancer les serveurs :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>------ &quot;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #ff0000;">&quot; ------&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_MONGODB</span>
<span style="color: #007800;">$PATH_MONGODB</span> <span style="color: #660033;">--fork</span> <span style="color: #660033;">--logpath</span> <span style="color: #007800;">$PATH_LOG_MONGODB</span> <span style="color: #660033;">--logappend</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>------ &quot;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #ff0000;">&quot; ------&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span>
<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #007800;">$PATH_NODEJS</span> <span style="color: #007800;">$PATH_SCRIPT_NODEJS</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS &amp; MongoDB are now up and running!&quot;</span></pre></div></div>

<p>
Au final, voici notre &laquo;&nbsp;start&nbsp;&raquo; :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># http://blog.2clics.net/2011/03/01/bash-script-nodejs-mongodb-daemon/</span>
&nbsp;
<span style="color: #007800;">PATH_NODEJS</span>=<span style="color: #ff0000;">&quot;/opt/local/bin/node&quot;</span>
<span style="color: #007800;">PATH_MONGODB</span>=<span style="color: #ff0000;">&quot;/opt/local/bin/mongod&quot;</span>
<span style="color: #007800;">PATH_LOG_NODEJS</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/log-N.log&quot;</span>
<span style="color: #007800;">PATH_LOG_MONGODB</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/log-M.log&quot;</span>
<span style="color: #007800;">PATH_SCRIPT_NODEJS</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/server.js&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Don't modify</span>
<span style="color: #007800;">ID_NODEJS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> ax <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> <span style="color: #ff0000;">'node'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iv</span> <span style="color: #ff0000;">'grep'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'\n'</span> <span style="color: #ff0000;">' '</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">ID_MONGODB</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> ax <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> <span style="color: #ff0000;">'mongod'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iv</span> <span style="color: #ff0000;">'grep'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'\n'</span> <span style="color: #ff0000;">' '</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
	start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting NodeJS/MongoDB...&quot;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ID_NODEJS</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS is already running, stop it first!&quot;</span>
			<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ID_MONGODB</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;MongoDB is already running, stop it first!&quot;</span>
			<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>------ &quot;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #ff0000;">&quot; ------&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_MONGODB</span>
			<span style="color: #007800;">$PATH_MONGODB</span> <span style="color: #660033;">--fork</span> <span style="color: #660033;">--logpath</span> <span style="color: #007800;">$PATH_LOG_MONGODB</span> <span style="color: #660033;">--logappend</span>
&nbsp;
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>------ &quot;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #ff0000;">&quot; ------&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span>
			<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #007800;">$PATH_NODEJS</span> <span style="color: #007800;">$PATH_SCRIPT_NODEJS</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS &amp; MongoDB are now up and running!&quot;</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 {start|stop|restart}&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p><strong>Etape 4</strong></p>
<p>
Le cas &laquo;&nbsp;stop&nbsp;&raquo;, on &laquo;&nbsp;kill&nbsp;&raquo; ces processus :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-TERM</span> <span style="color: #007800;">$ID_NODEJS</span>
<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-TERM</span> <span style="color: #007800;">$ID_MONGODB</span></pre></div></div>

<p>
Voici notre &laquo;&nbsp;stop&nbsp;&raquo; :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># http://blog.2clics.net/2011/03/01/bash-script-nodejs-mongodb-daemon/</span>
&nbsp;
<span style="color: #007800;">PATH_NODEJS</span>=<span style="color: #ff0000;">&quot;/opt/local/bin/node&quot;</span>
<span style="color: #007800;">PATH_MONGODB</span>=<span style="color: #ff0000;">&quot;/opt/local/bin/mongod&quot;</span>
<span style="color: #007800;">PATH_LOG_NODEJS</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/log-N.log&quot;</span>
<span style="color: #007800;">PATH_LOG_MONGODB</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/log-M.log&quot;</span>
<span style="color: #007800;">PATH_SCRIPT_NODEJS</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/server.js&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Don't modify</span>
<span style="color: #007800;">ID_NODEJS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> ax <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> <span style="color: #ff0000;">'node'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iv</span> <span style="color: #ff0000;">'grep'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'\n'</span> <span style="color: #ff0000;">' '</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">ID_MONGODB</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> ax <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> <span style="color: #ff0000;">'mongod'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iv</span> <span style="color: #ff0000;">'grep'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'\n'</span> <span style="color: #ff0000;">' '</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
	start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting NodeJS/MongoDB...&quot;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ID_NODEJS</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS is already running, stop it first!&quot;</span>
			<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ID_MONGODB</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;MongoDB is already running, stop it first!&quot;</span>
			<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>------ &quot;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #ff0000;">&quot; ------&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_MONGODB</span>
			<span style="color: #007800;">$PATH_MONGODB</span> <span style="color: #660033;">--fork</span> <span style="color: #660033;">--logpath</span> <span style="color: #007800;">$PATH_LOG_MONGODB</span> <span style="color: #660033;">--logappend</span>
&nbsp;
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>------ &quot;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #ff0000;">&quot; ------&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span>
			<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #007800;">$PATH_NODEJS</span> <span style="color: #007800;">$PATH_SCRIPT_NODEJS</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS &amp; MongoDB are now up and running!&quot;</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Shutting down NodeJS &amp; MongoDB...&quot;</span>
		<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-TERM</span> <span style="color: #007800;">$ID_NODEJS</span>
		<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-TERM</span> <span style="color: #007800;">$ID_MONGODB</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS &amp; MongoDB stopped!&quot;</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 {start|stop|restart}&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p><strong>Etape 5</strong></p>
<p>
Pour le restart, je ne redémarre que NodeJS.<br />
Je pars du principe que je n&#8217;ai pas à redémarrer MongoDB pendant le développement.<br />
Si je veux le redémarrer, je lance un &laquo;&nbsp;stop&nbsp;&raquo; puis un &laquo;&nbsp;start&nbsp;&raquo;.
</p>
<p>
On &laquo;&nbsp;kill&nbsp;&raquo; Node :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-TERM</span> <span style="color: #007800;">$ID_NODEJS</span></pre></div></div>

<p>
Puis on le redémarre :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>------ &quot;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #ff0000;">&quot; ------&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span>
<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #007800;">$PATH_NODEJS</span> <span style="color: #007800;">$PATH_SCRIPT_NODEJS</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span> <span style="color: #000000; font-weight: bold;">&amp;</span></pre></div></div>

<p>
Si vous voulez tout redémarrer, il faut mettre dans le restart :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #007800;">$0</span> stop  <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">3</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #007800;">$0</span> start</pre></div></div>

<p><strong>Etape 6</strong></p>
<p>Le script final :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># http://blog.2clics.net/2011/03/01/bash-script-nodejs-mongodb-daemon/</span>
&nbsp;
<span style="color: #007800;">PATH_NODEJS</span>=<span style="color: #ff0000;">&quot;/opt/local/bin/node&quot;</span>
<span style="color: #007800;">PATH_MONGODB</span>=<span style="color: #ff0000;">&quot;/opt/local/bin/mongod&quot;</span>
<span style="color: #007800;">PATH_LOG_NODEJS</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/log-N.log&quot;</span>
<span style="color: #007800;">PATH_LOG_MONGODB</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/log-M.log&quot;</span>
<span style="color: #007800;">PATH_SCRIPT_NODEJS</span>=<span style="color: #ff0000;">&quot;/Users/rodolphe/Dropbox/www/nodejs/server.js&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Don't modify</span>
<span style="color: #007800;">ID_NODEJS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> ax <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> <span style="color: #ff0000;">'node'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iv</span> <span style="color: #ff0000;">'grep'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'\n'</span> <span style="color: #ff0000;">' '</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">ID_MONGODB</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> ax <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> <span style="color: #ff0000;">'mongod'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iv</span> <span style="color: #ff0000;">'grep'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'\n'</span> <span style="color: #ff0000;">' '</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
	start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting NodeJS/MongoDB...&quot;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ID_NODEJS</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS is already running, stop it first!&quot;</span>
			<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ID_MONGODB</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;MongoDB is already running, stop it first!&quot;</span>
			<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>------ &quot;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #ff0000;">&quot; ------&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_MONGODB</span>
			<span style="color: #007800;">$PATH_MONGODB</span> <span style="color: #660033;">--fork</span> <span style="color: #660033;">--logpath</span> <span style="color: #007800;">$PATH_LOG_MONGODB</span> <span style="color: #660033;">--logappend</span>
&nbsp;
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>------ &quot;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #ff0000;">&quot; ------&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span>
			<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #007800;">$PATH_NODEJS</span> <span style="color: #007800;">$PATH_SCRIPT_NODEJS</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS &amp; MongoDB are now up and running!&quot;</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Shutting down NodeJS &amp; MongoDB...&quot;</span>
		<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-TERM</span> <span style="color: #007800;">$ID_NODEJS</span>
		<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-TERM</span> <span style="color: #007800;">$ID_MONGODB</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS &amp; MongoDB stopped!&quot;</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #666666; font-style: italic;">#sh $0 stop  &amp;&amp; sleep 3 &amp;&amp; sh $0 start</span>
&nbsp;
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Shutting down NodeJS...&quot;</span>
		<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-TERM</span> <span style="color: #007800;">$ID_NODEJS</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS stopped!&quot;</span>
&nbsp;
		<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">3</span>
&nbsp;
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting NodeJS...&quot;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>------ &quot;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #ff0000;">&quot; ------&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span>
		<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #007800;">$PATH_NODEJS</span> <span style="color: #007800;">$PATH_SCRIPT_NODEJS</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$PATH_LOG_NODEJS</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;NodeJS is now up and running!&quot;</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 {start|stop|restart}&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>Pour son utilisation, il suffit de l&#8217;appeller avec les suffixes start/stop/restart :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sh</span> launch.sh start
<span style="color: #c20cb9; font-weight: bold;">sh</span> launch.sh stop
<span style="color: #c20cb9; font-weight: bold;">sh</span> launch.sh restart</pre></div></div>

<p><a href="http://blog.2clics.net/wp-content/uploads/launch.sh" onclick="return TrackClick('http%3A%2F%2Fblog.2clics.net%2Fwp-content%2Fuploads%2Flaunch.sh','Le+fichier+peut-%C3%AAtre+t%C3%A9l%C3%A9charg%C3%A9+directement')">Le fichier peut-être téléchargé directement</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.2clics.net/2011/03/01/bash-script-nodejs-mongodb-daemon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installation de NPM pour NodeJS</title>
		<link>http://blog.2clics.net/2011/02/27/installation-npm-nodejs/</link>
		<comments>http://blog.2clics.net/2011/02/27/installation-npm-nodejs/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 09:02:18 +0000</pubDate>
		<dc:creator>Rodolphe Stoclin</dc:creator>
				<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[npm]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://blog.2clics.net/?p=75</guid>
		<description><![CDATA[<h3>NPM est un gestionnaire de modules pour NodeJS</h3>
<p>
Son installation est vraiment simple.<br />
Il s&#8217;installe en une ligne de commande :
</p>

<pre class="bash" style="font-family:monospace;">curl http:<span style="color: #000000; font-weight: bold;">//</span>npmjs.org<span style="color: #000000; font-weight: bold;">/</span>install.sh <span style="color: #000000; font-weight: bold;">&#124;</span> <span style="color: #c20cb9;</pre><p>&#8230; <a href="http://blog.2clics.net/2011/02/27/installation-npm-nodejs/" class="read_more">Lire la suite</a></p>]]></description>
			<content:encoded><![CDATA[<h3>NPM est un gestionnaire de modules pour NodeJS</h3>
<p>
Son installation est vraiment simple.<br />
Il s&#8217;installe en une ligne de commande :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curl http:<span style="color: #000000; font-weight: bold;">//</span>npmjs.org<span style="color: #000000; font-weight: bold;">/</span>install.sh <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">sh</span></pre></div></div>

<p>
Il ne vous reste plus qu&#8217;à installer les modules voulus.<br />
Par exemple, pour mon cas, ExpressJS et le drivers MongoDB-native.
</p>

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

]]></content:encoded>
			<wfw:commentRss>http://blog.2clics.net/2011/02/27/installation-npm-nodejs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installation manuelle de NodeJS depuis les sources</title>
		<link>http://blog.2clics.net/2011/02/26/installation-nodejs-sources/</link>
		<comments>http://blog.2clics.net/2011/02/26/installation-nodejs-sources/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 17:49:17 +0000</pubDate>
		<dc:creator>Rodolphe Stoclin</dc:creator>
				<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://blog.2clics.net/?p=79</guid>
		<description><![CDATA[<h3>Un tutoriel pour installer NodeJS sur Mac ou Linux.</h3>
<p>
Pour Mac, il faut les outils de développement, en l&#8217;occurrence Xcode.<br />
Si ce n&#8217;est pas le cas, vous pouvez l&#8217;installer depuis le DVD d&#8217;install de MacOSX.<br />
Ou sur&#8230; <a href="http://blog.2clics.net/2011/02/26/installation-nodejs-sources/" class="read_more">Lire la suite</a></p>]]></description>
			<content:encoded><![CDATA[<h3>Un tutoriel pour installer NodeJS sur Mac ou Linux.</h3>
<p>
Pour Mac, il faut les outils de développement, en l&#8217;occurrence Xcode.<br />
Si ce n&#8217;est pas le cas, vous pouvez l&#8217;installer depuis le DVD d&#8217;install de MacOSX.<br />
Ou sur le site d&#8217;Apple : <a href="http://developer.apple.com/technologies/xcode.html" onclick="return TrackClick('http%3A%2F%2Fdeveloper.apple.com%2Ftechnologies%2Fxcode.html','http%3A%2F%2Fdeveloper.apple.com%2Ftechnologies%2Fxcode.html')">http://developer.apple.com/technologies/xcode.html</a>
</p>
<p>
Pour Linux, il faut aussi les outils de compilation, soit GCC.
</p>
<p><strong>Etape 1</strong></p>
<p>
Récupérer l&#8217;archive sur le site de NodeJS : <a href="http://nodejs.org" onclick="return TrackClick('http%3A%2F%2Fnodejs.org','http%3A%2F%2Fnodejs.org')">http://nodejs.org</a><br />
Version actuelle (au 26/02/11), la 0.4.1 : <a href="http://nodejs.org/dist/node-v0.4.1.tar.gz" onclick="return TrackClick('http%3A%2F%2Fnodejs.org%2Fdist%2Fnode-v0.4.1.tar.gz','http%3A%2F%2Fnodejs.org%2Fdist%2Fnode-v0.4.1.tar.gz')">http://nodejs.org/dist/node-v0.4.1.tar.gz</a>
</p>
<p>En 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;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>nodejs.org<span style="color: #000000; font-weight: bold;">/</span>dist<span style="color: #000000; font-weight: bold;">/</span>node-v0.4.1.tar.gz</pre></div></div>

<p><strong>Etape 2</strong></p>
<p>
Décompresser l&#8217;archive :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-zxvf</span> node-v0.4.1.tar.gz</pre></div></div>

<p><strong>Etape 3</strong></p>
<p>Compilation et installation :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> node-v0.4.1
.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span>
<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>

<p><strong>Etape 4</strong></p>
<p>Vous pouvez ensuite tester Node avec un simple script (example.js) :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">var http = require<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'http'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
http.createServer<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req, res<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  res.writeHead<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">200</span>, <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">'Content-Type'</span>: <span style="color: #ff0000;">'text/plain'</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
  res.end<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'Hello World\n'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.listen<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">8124</span>, <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
console.log<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'Server running at http://127.0.0.1:8124/'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;</pre></div></div>

<p>Puis le lancer :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">node example.js</pre></div></div>

<p>Il est maintenant accessible par cette url :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">http:<span style="color: #000000; font-weight: bold;">//</span>127.0.0.1:<span style="color: #000000;">8124</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.2clics.net/2011/02/26/installation-nodejs-sources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installation de NodeJS et MongoDB sur MacOSX avec Port</title>
		<link>http://blog.2clics.net/2011/02/26/installation-nodejs-macosx-port/</link>
		<comments>http://blog.2clics.net/2011/02/26/installation-nodejs-macosx-port/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 17:41:20 +0000</pubDate>
		<dc:creator>Rodolphe Stoclin</dc:creator>
				<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://blog.2clics.net/?p=51</guid>
		<description><![CDATA[<h3>Une installation détaillée, pas à pas pour installer NodeJS et MongoDB sur un Mac.</h3>
<p>
Il faut avant toute chose avoir Xcode d&#8217;installé.<br />
Si ce n&#8217;est pas le cas, vous pouvez l&#8217;installer depuis le DVD d&#8217;install de MacOSX.<br />&#8230; <a href="http://blog.2clics.net/2011/02/26/installation-nodejs-macosx-port/" class="read_more">Lire la suite</a></p>]]></description>
			<content:encoded><![CDATA[<h3>Une installation détaillée, pas à pas pour installer NodeJS et MongoDB sur un Mac.</h3>
<p>
Il faut avant toute chose avoir Xcode d&#8217;installé.<br />
Si ce n&#8217;est pas le cas, vous pouvez l&#8217;installer depuis le DVD d&#8217;install de MacOSX.<br />
Ou sur le site d&#8217;Apple : <a href="http://developer.apple.com/technologies/xcode.html" onclick="return TrackClick('http%3A%2F%2Fdeveloper.apple.com%2Ftechnologies%2Fxcode.html','http%3A%2F%2Fdeveloper.apple.com%2Ftechnologies%2Fxcode.html')">http://developer.apple.com/technologies/xcode.html</a>
</p>
<p><strong>Etape 1</strong></p>
<p>
Installer Mac Port si ce n&#8217;est pas déjà fait.<br />
Récupérer l&#8217;install sur le site : <a href="http://www.macports.org/install.php" onclick="return TrackClick('http%3A%2F%2Fwww.macports.org%2Finstall.php','http%3A%2F%2Fwww.macports.org%2Finstall.php')">http://www.macports.org/install.php</a><br />
En l&#8217;occurence, pour Snow Leopard : <a href="http://distfiles.macports.org/MacPorts/MacPorts-1.9.2-10.6-SnowLeopard.dmg" onclick="return TrackClick('http%3A%2F%2Fdistfiles.macports.org%2FMacPorts%2FMacPorts-1.9.2-10.6-SnowLeopard.dmg','http%3A%2F%2Fdistfiles.macports.org%2FMacPorts%2FMacPorts-1.9.2-10.6-SnowLeopard.dmg')">http://distfiles.macports.org/MacPorts/MacPorts-1.9.2-10.6-SnowLeopard.dmg</a>
</p>
<p><strong>Etape 2</strong></p>
<p>
Une fois que Port est installé, il faut le mettre à jour :
</p>

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

<p>
Suivi après d&#8217;un :
</p>

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

<p><strong>Etape 3</strong></p>
<p>On installe Node et Mongo :</p>

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

<p>Ca peut-être un peu long, suivant votre machine.</p>
<p><strong>Etape 4</strong></p>
<p>Vous pouvez ensuite tester Node avec un simple script (example.js) :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">var http = require<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'http'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
http.createServer<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req, res<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  res.writeHead<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">200</span>, <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">'Content-Type'</span>: <span style="color: #ff0000;">'text/plain'</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
  res.end<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'Hello World\n'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.listen<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">8124</span>, <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
console.log<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'Server running at http://127.0.0.1:8124/'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;</pre></div></div>

<p>Puis le lancer :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">node example.js</pre></div></div>

<p>Il est maintenant accessible par cette url :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">http:<span style="color: #000000; font-weight: bold;">//</span>127.0.0.1:<span style="color: #000000;">8124</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.2clics.net/2011/02/26/installation-nodejs-macosx-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

