<?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>LogikDevelopment &#187; Linux</title>
	<atom:link href="http://www.logikdev.com/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.logikdev.com</link>
	<description>&#34;Il n&#039;y a pas de problème, il n&#039;y a que des solutions. L&#039;esprit de l&#039;homme invente ensuite le problème.&#34; André Gide</description>
	<lastBuildDate>Fri, 27 Aug 2010 08:54:27 +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>Relation between TortoiseSVN and locale</title>
		<link>http://www.logikdev.com/2010/08/15/relation-between-tortoisesvn-and-locale/</link>
		<comments>http://www.logikdev.com/2010/08/15/relation-between-tortoisesvn-and-locale/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 20:23:25 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[locale]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[TortoiseSVN]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=684</guid>
		<description><![CDATA[The other day, I got stuck on a problem with TortoiseSVN for about half a day! Yes, I know, it is a pretty long time to get a simple subversion client working&#8230; The error I was continuously getting was: Network connection closed unexpectedly Nothing else! Nothing in the log files on both the client and [...]]]></description>
			<content:encoded><![CDATA[<p>The other day, I got stuck on a problem with TortoiseSVN for about half a day! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_eek.gif' alt='8-O' class='wp-smiley' /><br />
Yes, I know, it is a pretty long time to get a simple subversion client working&#8230;</p>
<p>The error I was continuously getting was:</p>
<pre class="brush: plain; light: true;">
Network connection closed unexpectedly
</pre>
<p>Nothing else! Nothing in the log files on both the client and the server. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
The funny thing is that it was working perfectly fine using a command line client or even <a href="http://www.eclipse.org/subversive/">Eclipse Subversive</a>.</p>
<p>After a (too) long time of investigation, I noticed that I was getting the following warnings when I was running the following command line directly on the server:</p>
<pre class="brush: bash; light: true;">
$ svn list svn+ssh://smoreau@localhost/data/svn/
svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LANG is en_US.UTF-8
svn: warning: please check that your locale name is correct
smoreau@localhost's password:
svnserve: warning: cannot set LC_CTYPE locale
svnserve: warning: environment variable LANG is en_US.UTF-8
svnserve: warning: please check that your locale name is correct
branches/
tags/
trunk/
</pre>
<p>Actually, any <code>svn</code> command was triggering the warning messages:</p>
<pre class="brush: bash; light: true;">
$ svn info
svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LANG is en_US.UTF-8
svn: warning: please check that your locale name is correct
</pre>
<p><br/>Could it possibly be related with my TortoiseSVN problem?<br />
Because I didn&#8217;t have any other idea, I decided to give it a go. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>It appears that these warning messages came from a configuration problem around the locale package on the server. Indeed, look what we get if we run the <code>locale</code> command:</p>
<pre class="brush: bash; light: true;">
$ locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
POSIX
</pre>
<p>After some more investigation, it looks like this problem appeared when I upgraded the version of the locale package via <a href="http://en.wikipedia.org/wiki/Advanced_Packaging_Tool">APT</a>. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_confused.gif' alt=':-?' class='wp-smiley' /> </p>
<p>Once again, I asked my friend Google to help me out. It suggested me the following solutions:</p>
<ul>
<li>Run <code>locale-gen en_US.UTF-8</code> &#8211; <strong>Didn&#8217;t work</strong></li>
<li>Run <code>update-locale LANG=en_US.UTF-8</code> &#8211; <strong>Didn&#8217;t work</strong></li>
<li>Run <code>dpkg-reconfigure locales</code> &#8211; <strong>WORKED</strong> <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </li>
</ul>
<p><br/>In conclusion, I wasn&#8217;t able to use TortoiseSVN because of a configuration problem on the locale package after an upgrade&#8230; Does it make sense? <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_rolleyes.gif' alt=':roll:' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2010/08/15/relation-between-tortoisesvn-and-locale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the &#8216;date&#8217; command in your crontab</title>
		<link>http://www.logikdev.com/2010/05/25/using-the-date-command-in-your-crontab/</link>
		<comments>http://www.logikdev.com/2010/05/25/using-the-date-command-in-your-crontab/#comments</comments>
		<pubDate>Tue, 25 May 2010 18:15:42 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[date command]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=550</guid>
		<description><![CDATA[Crontab, as most people know, enables users to schedule commands or shell scripts to run periodically at certain times or dates. The other day, this very useful Linux tool gave me a hard time! Indeed, one of my commands wasn&#8217;t working in cron but was working perfectly fine when written in a shell console. The [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Crontab</strong>, as most people know, enables users to schedule commands or shell scripts to run periodically at certain times or dates.</p>
<p>The other day, this very useful Linux tool gave me a hard time! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
Indeed, one of my commands wasn&#8217;t working in cron but was working perfectly fine when written in a shell console.</p>
<p>The faulty command looked like this:</p>
<pre class="brush: bash; light: true;">
0 5 * * 3 /data/script.sh &gt; /data/script_`date +%y%m%d`.log 2&gt;&amp;1
</pre>
<p>If I run this command in a shell console, everything works fine and I get a log file containing today&#8217;s date in its filename. However, if I set this command line in my crontab, it doesn&#8217;t work and no log file is even created!</p>
<p>Reading the documentation of cron, I discovered the following statement:</p>
<blockquote><p>Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.</p></blockquote>
<p>Well, this is good to know, isn&#8217;t it? <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
We need to escape the percent-signs on our command line.</p>
<p>So in order to get our &#8216;faulty&#8217; command to run in cron, it needs to look like the following:</p>
<pre class="brush: bash; light: true;">
0 5 * * 3 /data/script.sh &gt; /data/script_`date +\%y\%m\%d`.log 2&gt;&amp;1
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2010/05/25/using-the-date-command-in-your-crontab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Locale settings for your cron job</title>
		<link>http://www.logikdev.com/2010/02/02/locale-settings-for-your-cron-job/</link>
		<comments>http://www.logikdev.com/2010/02/02/locale-settings-for-your-cron-job/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 22:55:35 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[locale]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[UTF-8]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=291</guid>
		<description><![CDATA[Do you get special characters problem when executing your bash script from a cron job? And does the same script work fine when it is directly executed from the command line? If yes, continue reading this article! The reason of this characters problem is probably because of your locale settings. Indeed, If you try to [...]]]></description>
			<content:encoded><![CDATA[<p>Do you get special characters problem when executing your bash script from a cron job?<br />
And does the same script work fine when it is directly executed from the command line?<br />
If yes, continue reading this article! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>The reason of this characters problem is probably because of your locale settings.<br />
Indeed, If you try to run the command <code>locale</code> from the command line and from a cron job, you may get different results such as:</p>
<table style="width: 100%; border:0px;">
<tbody>
<tr>
<td style="width:50%; border:0px;">From the command line</td>
<td style="width:50%; border:0px;">From a cron job</td>
</tr>
<tr>
<td style="border:0px;">
<pre class="brush: bash; light: true;">
LANG=en_US.UTF-8
LC_CTYPE=&quot;en_US.UTF-8&quot;
LC_NUMERIC=&quot;en_US.UTF-8&quot;
LC_TIME=&quot;en_US.UTF-8&quot;
LC_COLLATE=&quot;en_US.UTF-8&quot;
LC_MONETARY=&quot;en_US.UTF-8&quot;
LC_MESSAGES=&quot;en_US.UTF-8&quot;
LC_PAPER=&quot;en_US.UTF-8&quot;
LC_NAME=&quot;en_US.UTF-8&quot;
LC_ADDRESS=&quot;en_US.UTF-8&quot;
LC_TELEPHONE=&quot;en_US.UTF-8&quot;
LC_MEASUREMENT=&quot;en_US.UTF-8&quot;
LC_IDENTIFICATION=&quot;en_US.UTF-8&quot;
LC_ALL=
</pre>
</td>
<td style="border:0px;">
<pre class="brush: bash; light: true;">
LANG=
LC_CTYPE=&quot;POSIX&quot;
LC_NUMERIC=&quot;POSIX&quot;
LC_TIME=&quot;POSIX&quot;
LC_COLLATE=&quot;POSIX&quot;
LC_MONETARY=&quot;POSIX&quot;
LC_MESSAGES=&quot;POSIX&quot;
LC_PAPER=&quot;POSIX&quot;
LC_NAME=&quot;POSIX&quot;
LC_ADDRESS=&quot;POSIX&quot;
LC_TELEPHONE=&quot;POSIX&quot;
LC_MEASUREMENT=&quot;POSIX&quot;
LC_IDENTIFICATION=&quot;POSIX&quot;
LC_ALL=
</pre>
</td>
</tr>
</tbody>
</table>
<p>As you can see, the cron job is not using UTF-8. That must be the problem! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><br/>So the question now is how to change the locale settings for the cron job?<br />
Some people say that you need to add the following environment variables to the crontab entry:</p>
<pre class="brush: bash; light: true;">
SHELL=/bin/bash
LANG=en_US.UTF-8
LANGUAGE=en
LC_CTYPE=en_US.UTF-8
</pre>
<p>But this actually didn&#8217;t work for me. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p><br/>What you can do instead is create (if not already present) the file <code>/etc/environment</code> and add the following line:</p>
<pre class="brush: bash; light: true;">
LANG=en_US.UTF-8
</pre>
<p>The cron process will read this file when it starts, so you need to restart it in order to apply the change:</p>
<pre class="brush: bash; light: true;">
service cron restart
</pre>
<p><br/>Hope this will fix your characters problem. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2010/02/02/locale-settings-for-your-cron-job/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
