<?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>¡darandandunguen! &#187; bash</title>
	<atom:link href="http://www.darandandunguen.org/category/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.darandandunguen.org</link>
	<description>Gritos a mansalva.</description>
	<lastBuildDate>Wed, 27 May 2009 07:42:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>HOWTO: Mr. SID support in MapServer 5</title>
		<link>http://www.darandandunguen.org/2008/02/06/como-soporte-para-mr-sid-en-mapserver-5howto-mr-sid-support-in-mapserver-5/</link>
		<comments>http://www.darandandunguen.org/2008/02/06/como-soporte-para-mr-sid-en-mapserver-5howto-mr-sid-support-in-mapserver-5/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 10:58:01 +0000</pubDate>
		<dc:creator>manu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mapserver]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.darandandunguen.org/2008/02/06/como-soporte-para-mr-sid-en-mapserver-5howto-mr-sid-support-in-mapserver-5/</guid>
		<description><![CDATA[To add support to images in mrsid format, a library developed by Lizardtech is needed. This is propietary software so I&#8217;ve cropped this part out of  my main article on MapServer 5.


GeoDSK
First of all we need GeoSDK from Lizardtech (You&#8217;ll be asked to register to be able to download it). The file comes in [...]]]></description>
			<content:encoded><![CDATA[<p>To add support to images in <a href="http://en.wikipedia.org/wiki/MrSID">mrsid</a> format, a library developed by <a href="http://www.lizardtech.com">Lizardtech</a> is needed. This is propietary software so I&#8217;ve cropped this part out of  <a href="http://www.darandandunguen.org/2008/02/01/como-instalacion-de-mapserver-5-con-postgis-en-rhel5howto-mapserver-5-and-postgis-in-rhel5/">my main article on MapServer 5</a>.</p>
<p><span id="more-73"></span></p>
<ul>
<li>GeoDSK
<p>First of all we need GeoSDK from <a href="http://www.lizardtech.com">Lizardtech</a> (You&#8217;ll be asked to register to be able to download it). The file comes in several flavours (different kernel, gcc, glibc and libstdc++ versions), the one that best suits us is the gcc 3.4 one [Geo_DSDK-6.0.7.1407.linux.x86.gcc34.tar.gz].</p>
<p>Current RHEL5 gcc version is 4.2 but there are compat packages for gcc-3.4. We need them:</p>
<p><code>rpm -i /mnt/cd2/Server/compat-gcc-34-3.4.6-4.i386.rpm /mnt/cd2/Server/compat-gcc<br />
-34-c++-3.4.6-4.i386.rpm</code></p>
<p>Now it&#8217;s time to untar GeoSDK to a suitable location:</p>
<p><code>tar xzvf Geo_DSDK-6.0.7.1407.linux.x86.gcc34.tar.gz -C /usr/local/</code></p>
<p>This is a binary distribution so no more work is needed here.</p>
</li>
<li>GDAL
<p>Support is actually provided by GDAL library so we have to recompile it using our compat gcc and libstdc++ packages.</p>
<p><code>CC=gcc34 CXX=g++34 ./configure --with-png \<br />
--with-libtiff \<br />
--with-jpeg \<br />
--with-gif \<br />
--with-pg=/usr/local/pgsql/bin/pg_config \<br />
--with-geos \<br />
--with-odbc \<br />
--with-mrsid=/usr/local/Geo_DSDK-6.0.7.1407/<br />
make<br />
make install<br />
ldconfig</code></li>
</ul>
<p>Done! Of course, you may refer to <a href="http://www.darandandunguen.org/2008/02/01/como-instalacion-de-mapserver-5-con-postgis-en-rhel5howto-mapserver-5-and-postgis-in-rhel5/">my main article on MapServer 5</a> for all the details.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darandandunguen.org/2008/02/06/como-soporte-para-mr-sid-en-mapserver-5howto-mr-sid-support-in-mapserver-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Being Nerd</title>
		<link>http://www.darandandunguen.org/2007/01/26/siendo-frikibeing-nerd/</link>
		<comments>http://www.darandandunguen.org/2007/01/26/siendo-frikibeing-nerd/#comments</comments>
		<pubDate>Fri, 26 Jan 2007 15:40:31 +0000</pubDate>
		<dc:creator>manu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[chat]]></category>

		<guid isPermaLink="false">http://www.darandandunguen.org/2007/01/26/siendo-frikibeing-nerd/</guid>
		<description><![CDATA[


 I&#8217;ve loved the (rather nerdy) idea that my friend Julio has blogged about. Basically he wonders what are the most common commands he types on console (I know everyone that has worked besides him could tell you that it&#8217;s clear but he wanted a proof). So he worked out this command:
history &#124; awk '{print [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve loved <a href="http://www.julioduque.es/?p=13">the (rather nerdy) idea that my friend Julio has blogged about</a>. Basically he wonders what are the most common commands he types on console (I know everyone that has worked besides him could tell you that it&#8217;s <code>clear</code> but he wanted a proof). So he worked out this command:<br />
<code>history | awk '{print $2}' | sort | uniq -c | sort -nr | head -5</code><br />
to see which are his five most used commands. I&#8217;ve done the same on this machine and these are the results:<br />
<span id="more-48"></span></p>
<p>My user:</p>
<ul>
<li>129 ssh</li>
<li>109 su</li>
<li>74 startx</li>
<li>52 ldapvi</li>
<li>18 ./spamUpdater.sh</li>
</ul>
<p>spamUpdater.sh is a little sell script I wrote to feed spamassassin&#8217;s database (through sa-learn) with the spam that arrives to my mailbox.</p>
<p>root user:</p>
<ul>
<li>67 emerge</li>
<li>64 dhcpcd</li>
<li>37 halt</li>
<li>34 /etc/init.d/net.eth0</li>
<li>24 reboot</li>
</ul>
<p>So, as a good nerd, I spend more time <a href="http://www.gentoo.org/main/en/about.xml">updating this machine</a> than doing anything more productive.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darandandunguen.org/2007/01/26/siendo-frikibeing-nerd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using find to use sed on multiple directories</title>
		<link>http://www.darandandunguen.org/2006/11/10/using-find-to-use-sed-on-multiple-directoriesusando-find-para-utilizar-sed-en-multiples-subdirectorios/</link>
		<comments>http://www.darandandunguen.org/2006/11/10/using-find-to-use-sed-on-multiple-directoriesusando-find-para-utilizar-sed-en-multiples-subdirectorios/#comments</comments>
		<pubDate>Fri, 10 Nov 2006 10:48:08 +0000</pubDate>
		<dc:creator>manu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.darandandunguen.org/2006/11/10/using-find-to-use-sed-on-multiple-directoriesusando-find-para-utilizar-sed-en-multiples-subdirectorios/</guid>
		<description><![CDATA[Sed is a powerful line editor which can be used to modify text files in a non-interactive manner. Explaining it&#8217;s use would be to lengthy so I&#8217;ll just paste here it&#8217;s man page. The problem is that sed doesn&#8217;t allow us to use it across subdirectories but this can be easily achieved using find:
find ./ [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.gnu.org/software/sed/sed.html">Sed</a> is a powerful line editor which can be used to modify text files in a non-interactive manner. Explaining it&#8217;s use would be to lengthy so I&#8217;ll just paste <a href="http://www.gnu.org/software/sed/manual/html_mono/sed.html">here it&#8217;s man page</a>. The problem is that sed doesn&#8217;t allow us to use it across subdirectories but this can be easily achieved using <a href="http://www.gnu.org/software/findutils/">find</a>:<br />
<code>find ./ -type f -exec sed -e '[expression]' {} \;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.darandandunguen.org/2006/11/10/using-find-to-use-sed-on-multiple-directoriesusando-find-para-utilizar-sed-en-multiples-subdirectorios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mata al bloqueo de mayúsculas</title>
		<link>http://www.darandandunguen.org/2006/11/03/muerte-al-bloqueo-de-mayusculas/</link>
		<comments>http://www.darandandunguen.org/2006/11/03/muerte-al-bloqueo-de-mayusculas/#comments</comments>
		<pubDate>Fri, 03 Nov 2006 09:55:02 +0000</pubDate>
		<dc:creator>manu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.darandandunguen.org/2006/11/03/muerte-al-bloqueo-de-mayusculas/</guid>
		<description><![CDATA[Sí, me refiero a esa tecla. Si no entiendes qué pinta ese reducto del pasado en nuestros teclados y, como yo, sólo la pulsas por equivocación, deshazte de ella, vete a la consola y ejecuta:
 xmodmap -e 'remove Lock = Caps_Lock'
xmodmap -e 'keysym Caps_Lock = Shift_L'
xmodmap -e 'add Shift = Shift_L'
¡Tachán! El engendro ha pasado [...]]]></description>
			<content:encoded><![CDATA[<p>Sí, me refiero a <a href="http://www.microsiervos.com/archivo/ordenadores/muerte-bloqueo-mayusculas.html">esa tecla</a>. Si no entiendes qué pinta <a href="http://www.reasoner.org/wp-content/photos/CapsLock.jpg">ese reducto del pasado</a> en nuestros teclados y, como yo, sólo la pulsas por equivocación, deshazte de ella, vete a la consola y ejecuta:</p>
<p><code> xmodmap -e 'remove Lock = Caps_Lock'<br />
xmodmap -e 'keysym Caps_Lock = Shift_L'<br />
xmodmap -e 'add Shift = Shift_L'</code></p>
<p>¡Tachán! El engendro ha pasado a ser <a href="http://www.clickykeyboard.com/2005/keycaps/keys-058.jpg">otro botón de mayúsculas</a> normal y corriente. Para hacer los cambios permanentes, añádelos al archivo .profile</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darandandunguen.org/2006/11/03/muerte-al-bloqueo-de-mayusculas/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Namecheap, ddclient y Debian</title>
		<link>http://www.darandandunguen.org/2006/02/27/namecheap-ddclient-y-debian/</link>
		<comments>http://www.darandandunguen.org/2006/02/27/namecheap-ddclient-y-debian/#comments</comments>
		<pubDate>Mon, 27 Feb 2006 19:23:11 +0000</pubDate>
		<dc:creator>manu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.darandandunguen.org/2006/02/27/namecheap-ddclient-y-debian/</guid>
		<description><![CDATA[ddclient es un software que permite actualizar tu IP en los servidores de nombres de forma automatizada para los que sufrimos IPs dinámicas. La versión de ddclient en Debian es la 3.6.2 y desgraciadamente el soporte para Namecheap es posterior. Namecheap es una empresa donde puedes registrar tus dominios por un precio bastante módico. De [...]]]></description>
			<content:encoded><![CDATA[<p>ddclient es un software que permite actualizar tu IP en los servidores de nombres de forma automatizada para los que sufrimos IPs dinámicas. La versión de ddclient en Debian es la 3.6.2 y desgraciadamente el soporte para Namecheap es posterior. Namecheap es una empresa donde puedes registrar tus dominios por un precio bastante módico. De todos modos, lo mejor es instalar el paquete y después modificar dos archivos. Descarga la última versión de sourceforge, descomprime su contenido y machaca el archivo <em>/usr/sbin/ddclient</em> con el del archivo.</p>
<p><code>cd /usr/src<br />
tar xjvf ddclient-3.6.7.tbz<br />
mv ddclient-3.6.7/ddclient /sbin/ddclient</code></p>
<p>Elimina el archivo <em>/etc/dclient.conf</em><br />
<code>rm /etc/ddclient.conf</code></p>
<p>Crea el archivo <em>/etc/ddclient/ddclient.conf</em> a partir del ejemplo y actualízalo con tus datos</p>
<p><code>cp ddclient-3.6.7/sample-etc_ddclient.conf /etc/ddclient/ddclient.conf</code></p>
<p>Al final del archivo está la sección destinada a Namecheap. La contraseña que debes poner es la que te aparece en la página de tu dominio en Namecheap en la pestaña <em>Dynamic DNS</em>. Como depende del dominio, deberás escribir una entrada distinta para cada uno de tus dominios.</p>
<p><b>ACTUALIZACIÓN</b></p>
<p>Parece que no todo está funcionando correctamente, por lo que esta mañana, cuando cambió la IP, el blog se ha ido al limbo. Sin embargo he encontrado en <a href="http://marc.noctambuls.net/?p=35">Marc @ blog</a> un script que parece solucionar la tarea. El (pequeño) problema es que su script es para un único dominio y yo tengo varios. Las modificaciones que he hecho no las puedo publicar porque la licencia de <a href="http://marc.noctambuls.net/?p=35">Marc @ blog</a> <a href="http://creativecommons.org/licenses/by-nc-nd/2.5/">no permite trabajos derivados</a>, pero no creo que tengáis problemas para hacerlos vosotros si los necesitáis. La prueba de fuego en el próximo cambio de IP.</p>
<p><b>ACTUALIZACIÓN 2</b></p>
<p>Me he puesto en contacto con <a href="http://marc.noctambuls.net/?p=35">Marc</a> y no tiene ningún problema en que comporta mis cambios. Los cambios principales en el script son:</p>
<ul>
<li>Soporte para varios dominios</li>
<li>Fuerza la actualización de la IP en la siguiente ejecución si la actualización falla</li>
<li>Manda un mensaje al syslog cuando actualiza la IP o cuando la actualización falla</li>
</ul>
<p><b>ACTUALIZACIÓN 3</b></p>
<p>He hecho un pequño al script porque la página de <a href="http://www.whatismyip.com">whatismyip</a> ha cambiado.<br />
<span id="more-29"></span>
</p>
<p>Para configurarlo debéis rellenar el campo CONFIG_PATH y escribir el fichero <i>domains.list</i></p>
<p><code><br />
#!/bin/bash</code><br />
# Namecheap update script v1.01</p>
<p><code># Path where the configuration files are is<br />
CONFIG_PATH="/usr/local/etc/namecheap"</code><br />
<code><br />
#==== No more config parameters past this line ====#</code></p>
<p><code># Root only<br />
if [ `id -u` -ne 0 ] ; then<br />
    echo "You MUST be root to execute this script!"<br />
    exit<br />
fi</code></p>
<p><code># Is domains file present?<br />
if [ ! -e "${CONFIG_PATH}/domains.list" ]; then<br />
        mkdir -p ${CONFIG_PATH}<br />
        echo "${CONFIG_PATH}/domains.list not found!"<br />
        echo "This is a configuration file for namecheap script"<br />
        echo "Add one line to the file for each domain to keep updated"<br />
        echo "Line Format:"<br />
        echo "[domain] [password] [subdomain],[subdomain2],..."<br />
        echo "Lines starting with a # and blank lines will be ignored"<br />
        exit<br />
fi</code></p>
<p><code># What is my current IP?<br />
NEW_IP=`lynx -dump http://www.whatismyip.org`</code></p>
<p><code>if [ -n "${NEW_IP}" ]; then</code></p>
<p>     <code>   # First execution<br />
        if [ ! -e "${CONFIG_PATH}/old_ip" ]; then<br />
                mkdir -p ${CONFIG_PATH}<br />
                touch ${CONFIG_PATH}/old_ip<br />
        fi</code></p>
<p>        <code>OLD_IP=`cat ${CONFIG_PATH}/old_ip`</code></p>
<p>        <code># Has my IP been updated?<br />
        if [ "${NEW_IP}" != "${OLD_IP}" ] ; then</code></p>
<p>                <code># old_ip file update<br />
                echo ${NEW_IP} > ${CONFIG_PATH}/old_ip</code></p>
<p>                <code># I make a HTTP GET request for every subdomain in each domain I have registered<br />
                exec < ${CONFIG_PATH}/domains.list<br />
                while read LINE<br />
                do<br />
                if [[ -n `echo $LINE | grep -v '^#' | grep -v '^$'` ]]<br />
                then<br />
                        NAMECHEAP_PWD=`echo ${LINE}| cut -d' ' -f2`<br />
                        DOMAIN=`echo ${LINE}| cut -d' ' -f1`<br />
                        SUBDOMAINS=`echo ${LINE}| cut -d' ' -f3 | sed -e 's/\,/\ /g'`<br />
                        for SUBDOMAIN in ${SUBDOMAINS}<br />
                        do<br />
                                LOG=`lynx -dump "http://dynamicdns.park-your-domain.com/update?host=${SUBDOMAIN}&#038;domain=${DOMAIN}&#038;password=${NAMECHEAP_PWD}&#038;ip=${NEW_IP}"`<br />
                                LOG2=`echo ${LOG} | grep true`<br />
                                if [[ -n ${LOG2} ]]; then<br />
                                        logger -t namecheap "Updated IP for  ${SUBDOMAIN}.${DOMAIN}. Server Answers: ${LOG}"<br />
                                else<br />
                                        logger -t namecheap "Error: can't update ip for ${SUBDOMAIN}.${DOMAIN}. Forcing an update on next run!. Server Answers: ${LOG}"<br />
                                        echo ${LOG2} > ${CONFIG_PATH}/old_ip<br />
                                fi<br />
                        done<br />
                fi<br />
                done<br />
        fi<br />
fi<br />
</code></p>
<p>El fichero <i>domains.list</i> debe ser como este</p>
<p><code><br />
#Configuration file for namecheap script<br />
#Add one line for each domain to update.<br />
#Format:<br />
#[domain] [password] [subdomain],[subdomain2],...</code></p>
<p><code>dominio1 password1 subdominio1,subdominio2</code></p>
<p><code>dominio2 password2 subdominio3,subdominio4,subdominio5<br />
dominio3 password3 subdominio6<br />
</code></p>
<p>Por último, haz que se ejecute periodicamente añadiendo al <em>crontab</em> del root la línea</p>
<p><code>*/10 * * * * [path_al_script]/namecheap</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.darandandunguen.org/2006/02/27/namecheap-ddclient-y-debian/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->