<?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>[root@cyberdeaf.org /]$ rm -rf ./ &#187; utile</title>
	<atom:link href="http://blog.cyberdeaf.org/utile/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.cyberdeaf.org</link>
	<description>Roba da /dev/null... Ovvero: delirii su vita, informatica ed altro</description>
	<lastBuildDate>Tue, 31 Aug 2010 12:48:46 +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>Chi è a dieta&#8230;</title>
		<link>http://blog.cyberdeaf.org/2010/chi-e-a-dieta</link>
		<comments>http://blog.cyberdeaf.org/2010/chi-e-a-dieta#comments</comments>
		<pubDate>Sun, 04 Jul 2010 18:42:41 +0000</pubDate>
		<dc:creator>The CyberDeaf</dc:creator>
				<category><![CDATA[utile]]></category>
		<category><![CDATA[varie]]></category>
		<category><![CDATA[opinioni]]></category>
		<category><![CDATA[svago]]></category>

		<guid isPermaLink="false">http://blog.cyberdeaf.org/?p=1381</guid>
		<description><![CDATA[&#8230;farebbe bene a non proseguire nella lettura. A chi vive o passa dalle parti di Torino, vorrei suggerirgli un posto dove si mangia stupendamente, gestito da due miei amici. Prima avevano un ristorante ad Acilia e ci andavamo molto spesso. Tant&#8217;è che si ricordano ancora di me (ero l&#8217;unica che aveva il coraggio di leccarsi [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230;farebbe bene a non proseguire nella lettura.<span id="more-1381"></span></p>
<p>A chi vive o passa dalle parti di Torino, vorrei suggerirgli un posto dove si mangia stupendamente, gestito da due miei amici. Prima avevano un ristorante ad Acilia e ci andavamo molto spesso. Tant&#8217;è che si ricordano ancora di me (ero l&#8217;unica che aveva il coraggio di leccarsi il piatto!). Poi si sono trasferiti lassù.</p>
<p>Mi ci è voluto molto tempo per rassegnarmi al loro trasferimento. Solo che qualche volta me li sogno ancora, i loro capolavori gastronomici. E mi sveglio col cuscino mezzo masticato e mezzo fracico. Di bava.</p>
<p>Indi, per vendicarmi della loro partenza, vi svelo il nuovo indirizzo:</p>
<p><center><br />
<strong>Ristorante Cavour</strong><br />
Via Cavour 9,<br />
Strambinello (TO)<br />
Tel.: 0125 76199<br />
Email: inforistorantecavour@libero.it<br />
</center></p>
<p>Per i pignoli: sta a tipo 43 km da Torino.</p>
<p>Se ingrassate o ne diventate dipendenti, sono cazzi vostri. Io vi ho avvisato :)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cyberdeaf.org/2010/chi-e-a-dieta/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Vi interessa?</title>
		<link>http://blog.cyberdeaf.org/2010/vi-interessa</link>
		<comments>http://blog.cyberdeaf.org/2010/vi-interessa#comments</comments>
		<pubDate>Mon, 28 Jun 2010 21:41:40 +0000</pubDate>
		<dc:creator>The CyberDeaf</dc:creator>
				<category><![CDATA[utile]]></category>
		<category><![CDATA[vita]]></category>
		<category><![CDATA[letture]]></category>
		<category><![CDATA[opinioni]]></category>

		<guid isPermaLink="false">http://blog.cyberdeaf.org/?p=1378</guid>
		<description><![CDATA[Potrebbe interessarvi sapere che un certo Saverio Tommasi ha raccolto in un libro-pdf le &#8220;migliori&#8221; intercettazioni dal 1983 ad oggi&#8230; Lo potete scaricare gratuitamente dal suo sito, a questo link: http://www.saveriotommasi.it/blog/intercettazioni/. Buona lettura.]]></description>
			<content:encoded><![CDATA[<p>Potrebbe interessarvi sapere che un certo Saverio Tommasi ha raccolto in un libro-pdf le &#8220;migliori&#8221; intercettazioni dal 1983 ad oggi&#8230;</p>
<p>Lo potete scaricare gratuitamente dal suo sito, a questo link: <a href="http://www.saveriotommasi.it/blog/intercettazioni/" target="_blank">http://www.saveriotommasi.it/blog/intercettazioni/</a>.</p>
<p>Buona lettura.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cyberdeaf.org/2010/vi-interessa/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sarò solo io che&#8230;</title>
		<link>http://blog.cyberdeaf.org/2010/saro-solo-io-che</link>
		<comments>http://blog.cyberdeaf.org/2010/saro-solo-io-che#comments</comments>
		<pubDate>Tue, 30 Mar 2010 08:56:37 +0000</pubDate>
		<dc:creator>The CyberDeaf</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[utile]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[gnome]]></category>

		<guid isPermaLink="false">http://blog.cyberdeaf.org/?p=1319</guid>
		<description><![CDATA[&#8230; sono irritabile di mio? Comunque sia, non so il percome e il perché, ne&#8217; di chi sia la colpa, sta di fatto che da un po&#8217; di tempo in qua ogni qualvolta che avvio Gnome con startx&#8230; &#8230;Mi ritrovo con un sacco di processi &#8220;fuffosi&#8221; creati da xorg/gnome che non vengono MAI killati quando [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; sono irritabile di mio?</p>
<p>Comunque sia, non so il percome e il perché, ne&#8217; di chi sia la colpa, sta di fatto che da un po&#8217; di tempo in qua ogni qualvolta che avvio Gnome con <code>startx</code>&#8230;<span id="more-1319"></span></p>
<p>&#8230;Mi ritrovo con un sacco di processi &#8220;fuffosi&#8221; creati da xorg/gnome che non vengono MAI killati quando si esce da Gnome, tipo ennemila <code>console-kit-daemon</code> (che NON parte al boot, ma parte di suo quando lancio xorg/gnome) e i vari <code>gvfsd</code>.</p>
<p>Quindi, non avendo voglia di indagare nei millemila file di configurazione legati a Gnome/xorg/sarcazzo, ho inserito in <code><em>.bash_logout</em></code> queste righe:</p>
<pre>if [ "$SHLVL" = 1 ]; then
	sudo killall console-kit-daemon
	killall -user $USER
fi</pre>
<p>È molto crudo/brutale, ma almeno mi toglie dalle palle la fuffa creatasi con l&#8217;uso di Gnome/xorg e &#8220;dimenticata&#8221; da questi al momento di uscirne.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cyberdeaf.org/2010/saro-solo-io-che/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Altri 2 script bash&#8230;</title>
		<link>http://blog.cyberdeaf.org/2010/altri-2-script-bash</link>
		<comments>http://blog.cyberdeaf.org/2010/altri-2-script-bash#comments</comments>
		<pubDate>Tue, 23 Mar 2010 17:55:40 +0000</pubDate>
		<dc:creator>The CyberDeaf</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[utile]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[gnome]]></category>

		<guid isPermaLink="false">http://blog.cyberdeaf.org/?p=1286</guid>
		<description><![CDATA[Per motivi vari (non legati direttamente al lavoro) m&#8217;è capitato di dover &#8220;riciclare&#8221; ed adattare uno script bash che avevo fatto tipo 5 anni fa (!).. E me ne sono venuti fuori due di scripts. Questo è da ficcare nel crontab e ha come obiettivo quello di verificare che un servizio/daemon sia *realmente* disponibile ed [...]]]></description>
			<content:encoded><![CDATA[<p>Per motivi vari (non legati direttamente al lavoro) m&#8217;è capitato di dover &#8220;riciclare&#8221; ed adattare uno <a href="http://blog.cyberdeaf.org/2005/evvai">script bash</a> che avevo fatto tipo 5 anni fa (!).. E me ne sono venuti fuori due di scripts.<br />
<span id="more-1286"></span></p>
<p>Questo è da ficcare nel crontab e ha come obiettivo quello di verificare che un servizio/daemon sia *realmente* disponibile ed utilizzabile via internet. Richiede la presenza sul server in questione di telnet e di wget oppure curl. Attenzione, è statp scritto per un amico per il suo server (a cui non ho accesso &#8220;diretto&#8221;), quindi usatelo a vostro rischio e pericolo.</p>
<p><strong>chk_service.sh</strong><br />
<code>
<pre>#!/bin/bash

OWNER_UID=1000           # UID of user owning the daemon to be checked
ROOT_UID=0               # Only users with UID 0 have root privileges.
E_WRONGUID=67            # Some arbitrary exit error.
DAEMON=quelchevolete     # Name of the service to kill/restart
TO=10                    # timeout of connection in seconds
MT=15                    # maximum time to run curl/wget
ADDR=123.456.789.123     # address of service to check upon
PORT=1234                # port
STRING=Quelkevipare      # string to look for in service's output

# change this to suit your needs/preferences
LOGFILE=/path/to/chk_$DAEMON.log

if [ "$UID" -ne "$ROOT_UID" ] &amp;&amp; [ "$UID" -ne "$OWNER_UID" ]
then
	echo "Must be root or owner to run this script."
	exit $E_WRONGUID
fi

if [ ! -d "$LOGFILE" ]
then
	touch $LOGFILE
	chmod 640 $LOGFILE
fi

# using telnet to see if $ADDR it is accepting connections on $PORT
# the use of exit 1 instead of calling a restart is because that service
# MAY be right in the middle of rebooting...

echo -en "o $ADDR $PORT\nquit\n" |/usr/bin/telnet 2&gt;/dev/null | /bin/grep 'Connected to' &gt; /dev/null 2&gt;&amp;1
if [ "$?" -ne 0 ]; then
	echo `/bin/date +'%b %e %H:%M:%S'`" -- Server $ADDR NOT accepting connections on port $PORT!!!" &gt;&gt; $LOGFILE
	exit 1
else

# check if $DAEMON is outputting the right output (uncomment curl if you don't have wget and viceversa)

# using curl...
#	echo "\r\n" | /usr/bin/curl -T "-" -s --connect-timeout $TO --max-time $MT telnet://$ADDR:$PORT | /bin/grep $STRING &gt; /dev/null 2&gt;&amp;1

# using wget...
	<del datetime="2010-03-24T01:39:06+00:00">/usr/bin/wget -qO - "$@" http://$ADDR:$PORT | /bin/grep $STRING &gt; /dev/null 2&gt;&amp;1</del>
	/usr/bin/wget -t 1 --read-timeout=$TO -T $MT -qO - "$@" http://$ADDR:$PORT | /bin/grep $STRING &gt; /dev/null 2&gt;&amp;1

	if [ "$?" -eq 0 ]; then
		echo `/bin/date +'%b %e %H:%M:%S'`" -- $DAEMON is active." &gt;&gt; $LOGFILE
		exit 0
	else  # trying to re-start the missing service
		echo `/bin/date +'%b %e %H:%M:%S'`" -- $DAEMON died between last check and this! Killing it..." &gt;&gt; $LOGFILE
		# PLEASE put here the command you would use for restarting the $DAEMON
		#/usr/bin/killall $DAEMON &gt; /dev/null 2&gt;&amp;1

		if [ "$?" -eq 0 ]; then
			echo `/bin/date +'%b %e %H:%M:%S'`" -- $DAEMON killed successfully" &gt;&gt; $LOGFILE
			exit 0
		else
			echo `/bin/date +'%b %e %H:%M:%S'`" -- Unable to kill $DAEMON. Sorry!!!" &gt;&gt; $LOGFILE
		exit 1
		fi
	fi
fi</pre>
<p></code><br />
Questo invece controlla da &#8220;remoto&#8221; se un daemon/servizio su un dato server è disponibile o no ed avvisa di conseguenza l&#8217;utente. Funziona di sicuro in Gnome. Che funga anche dalla consolle non saprei, è ancora da testare fino in fondo. Anche questo sarebbe da ficcare dentro crontab (il che delle volte presenta degli inconvenienti dal punto di vista dell&#8217;utente)&#8230;</p>
<p><strong>chk_remote_service.sh</strong><br />
<code>
<pre>#!/bin/bash

OWNER_UID=1000           # UID of user owning the daemon to be checked
ROOT_UID=0               # Only users with UID 0 have root privileges.
E_WRONGUID=67            # Some arbitrary exit error.
DAEMON=quelchevolete     # Name of the service to kill/restart
TO=10                    # timeout of connection in seconds
MT=15                    # maximum time to run curl/wget
ADDR=123.456.789.123     # address of service to check upon
PORT=1234                # port
STRING=Quelkevipare      # string to look for in service's output

# change this to suit your needs/preferences
LOGFILE=/path/to/chk_$DAEMON.log

if [ "$UID" -ne "$ROOT_UID" ] &amp;&amp; [ "$UID" -ne "$OWNER_UID" ]
then
	echo "Must be root or owner to run this script."
	exit $E_WRONGUID
fi

if [ ! -d "$LOGFILE" ]
then
	touch $LOGFILE
	chmod 640 $LOGFILE
fi

# using telnet to see if $ADDR it is accepting connections on $PORT
echo -en "o $ADDR $PORT\nquit\n" |/usr/bin/telnet 2&gt;/dev/null | /bin/grep 'Connected to' &gt; /dev/null 2&gt;&amp;1
if [ "$?" -ne 0 ]; then
	echo `/bin/date +'%b %e %H:%M:%S'`" -- Server $ADDR NOT accepting connections on port $PORT!!!" &gt;&gt; $LOGFILE
	TXT="Server hosting $DAEMON DOWN\!"
else

# check if $DAEMON is outputting the right output (uncomment curl if you don't have wget and viceversa)

# using curl...
#	echo "\r\n" | /usr/bin/curl -T "-" -s --connect-timeout $TO --max-time $MT telnet://$ADDR:$PORT | /bin/grep $STRING &gt; /dev/null 2&gt;&amp;1

# using wget...
	<del datetime="2010-03-24T01:39:06+00:00">/usr/bin/wget -qO - "$@" http://$ADDR:$PORT | /bin/grep $STRING &gt; /dev/null 2&gt;&amp;1</del>
	/usr/bin/wget -t 1 --read-timeout=$TO -T $MT -qO - "$@" http://$ADDR:$PORT | /bin/grep $STRING &gt; /dev/null 2&gt;&amp;1

	if [ "$?" -eq 0 ]; then
		echo `/bin/date +'%b %e %H:%M:%S'`" -- $DAEMON is active." &gt;&gt; $LOGFILE
		TXT="$DAEMON is UP\!"
	else
		echo `/bin/date +'%b %e %H:%M:%S'`" -- $DAEMON died between last check and this!" &gt;&gt; $LOGFILE
		TXT="$DAEMON is DOWN\!"
	fi
fi

# you may need to put "xhost local:username &gt; /dev/null" in .bashrc or .bash_profile FIRST
# if you don't have/use gnome, please uncomment xmessage and comment off zenity.
# want zenity in front of everything? edit zenity.glade &amp; change the "focus_on_map" property to "True"

/usr/bin/lsof -c xinit &gt; /dev/null 2&gt;&amp;1
if [ "$?" -eq 0 ]; then
#	/usr/bin/xmessage -display :0.0 -center -timeout 5 $TXT
	/usr/bin/zenity --display=:0.0 --warning --width=160 --height=40 --timeout=5 --text="$TXT"
else
	/usr/bin/lsof -lc bash | grep /bin/bash | grep "\ $OWNER_UID\ \|\ $ROOT_UID\ " &gt; /dev/null 2&gt;&amp;1
	if [ "$?" -eq 0 ]; then
		/usr/bin/dialog --timeout 5 --msgbox "$TXT" 6 20
	else
		/usr/bin/wall "$TXT"
	fi
fi
exit 0
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cyberdeaf.org/2010/altri-2-script-bash/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CLI e Bash</title>
		<link>http://blog.cyberdeaf.org/2010/cli-bash</link>
		<comments>http://blog.cyberdeaf.org/2010/cli-bash#comments</comments>
		<pubDate>Tue, 23 Mar 2010 13:26:29 +0000</pubDate>
		<dc:creator>The CyberDeaf</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[utile]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://blog.cyberdeaf.org/?p=1277</guid>
		<description><![CDATA[Lo so, probabilmente qualcuno dei &#8220;soliti&#8221; 30 lettori lo conosce già, ma non potevo evitare di segnalare questo sito: http://www.commandlinefu.com/&#8230; :) P.S.: la funzione di ricerca c&#8217;è, dovete solo cercare meglio :)]]></description>
			<content:encoded><![CDATA[<p>Lo so, probabilmente qualcuno dei &#8220;soliti&#8221; 30 lettori lo conosce già, ma non potevo evitare di segnalare questo sito: <a href="http://www.commandlinefu.com/" target="_blank">http://www.commandlinefu.com/</a>&#8230; :)</p>
<p><em>P.S.: la funzione di ricerca c&#8217;è, dovete solo cercare meglio :)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cyberdeaf.org/2010/cli-bash/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
