<?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>Linux T&#38;T &#187; Scripts</title>
	<atom:link href="http://linux.wxs.ro/category/scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://linux.wxs.ro</link>
	<description>WladyX’s collection of linux tips&#38;tricks</description>
	<lastBuildDate>Fri, 27 Jan 2012 16:42:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Find and remove files older than 30 days</title>
		<link>http://linux.wxs.ro/2012/01/26/find-and-remove-files-older-than-30-days/</link>
		<comments>http://linux.wxs.ro/2012/01/26/find-and-remove-files-older-than-30-days/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 16:19:50 +0000</pubDate>
		<dc:creator>WladyX</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://linux.wxs.ro/?p=1843</guid>
		<description><![CDATA[find /folder -type f -mtime +30 -exec rm -rf {} \;]]></description>
			<content:encoded><![CDATA[<p><code>find /folder -type f -mtime +30 -exec rm -rf {} \;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linux.wxs.ro/2012/01/26/find-and-remove-files-older-than-30-days/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash eternal history</title>
		<link>http://linux.wxs.ro/2012/01/24/bash-eternal-history/</link>
		<comments>http://linux.wxs.ro/2012/01/24/bash-eternal-history/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 16:32:28 +0000</pubDate>
		<dc:creator>WladyX</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://linux.wxs.ro/?p=1833</guid>
		<description><![CDATA[export HISTTIMEFORMAT="%h/%d - %H:%M:%S " PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $$ $USER \ "$(history 1)" &#62;&#62; ~/.bash_eternal_history' source]]></description>
			<content:encoded><![CDATA[<p><code>export HISTTIMEFORMAT="%h/%d - %H:%M:%S "<br />
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $$ $USER \<br />
"$(history 1)" &gt;&gt; ~/.bash_eternal_history'</code></p>
<p><a href="http://www.debian-administration.org/articles/543">source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://linux.wxs.ro/2012/01/24/bash-eternal-history/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mail to SMS using procmail</title>
		<link>http://linux.wxs.ro/2012/01/12/mail-to-sms-using-procmail/</link>
		<comments>http://linux.wxs.ro/2012/01/12/mail-to-sms-using-procmail/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 15:36:39 +0000</pubDate>
		<dc:creator>WladyX</dc:creator>
				<category><![CDATA[Cool Apps]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://linux.wxs.ro/?p=1810</guid>
		<description><![CDATA[Installation Once you have plugged the USB Data cable and the T230 phone, you may have: root@smsserver:~# lsusb Bus 001 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port Bus 001 Device 001: ID 0000:0000 root@fr-c400-0257-l:~# ls -la /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 0 2007-03-22 10:17 /dev/ttyUSB0 root@smsserver:~# You can test your configuration [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;">Installation</span></strong><br />
Once you have plugged the USB Data cable and the T230 phone, you may have:</p>
<blockquote><p><code>root@smsserver:~# lsusb<br />
Bus 001 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port<br />
Bus 001 Device 001: ID 0000:0000<br />
root@fr-c400-0257-l:~# ls -la /dev/ttyUSB0<br />
crw-rw---- 1 root dialout 188, 0 2007-03-22 10:17 /dev/ttyUSB0<br />
root@smsserver:~#<br />
</code></p></blockquote>
<p>You can test your configuration using minicom</p>
<blockquote><p><code>root@smsserver:~# minicom -s<br />
</code></p></blockquote>
<p><code>-s</code> is for minicom setup on launch. You may configure the serial port to <code>/dev/ttyUSB0</code> and the speed to <code>9600 8N1</code>.</p>
<blockquote><p><code>Welcome to minicom 2.2<br />
OPTIONS: I18n<br />
Compiled on Mar 7 2007, 15:10:03.<br />
Port /dev/ttyUSB0<br />
</code><br />
<code> Press CTRL-A Z for help on special keys</code><br />
<code><br />
AT S7=45 S0=0 L1 V1 X4 &amp;c1 E1 Q0<br />
OK<br />
AT&amp;C1<br />
OK<br />
ATM0<br />
OK<br />
ATDT1234<br />
NO CARRIER<br />
ATM0<br />
OK<br />
AT+CPIN?<br />
+CPIN: READY<br />
</code><code><br />
OK<br />
AT+CMGF=1<br />
OK<br />
AT+CMGS<br />
ERROR<br />
AT+CMGS="06XXXXXXXX"<br />
&gt; Hello World<br />
+CMGS: 0<br />
</code><code><br />
OK<br />
</code></p></blockquote>
<p><strong><span style="text-decoration: underline;">gnokii settings</span></strong><br />
Edit the <code>/etc/gnokiirc</code> file:</p>
<blockquote><p><code>port = /dev/ttyUSB0<br />
[...]<br />
model = AT<br />
# model = 6510<br />
[...]<br />
use_locking = no<br />
#use_locking = yes<br />
[...]<br />
serial_baudrate = 9600<br />
# serial_baudrate = 19200</p>
<p></code></p></blockquote>
<p>The use_locking setting has been modified as it may happen that I send SMS to more than one people at a time. The solution would be to use smsd…</p>
<p><strong><span style="text-decoration: underline;">From Mail to SMS</span></strong></p>
<p>As we are using postfix and procmail, root user may not be used!<br />
Let’s create a <code>itroot</code> user that will be the recipient of email notification to be turned into SMS.<br />
Create a .procmailrc file for this user. A convention will be used for notification emails. The subject will contain <code>[SMS]</code> and only the subject of the email will be transfered as an SMS:</p>
<blockquote><p><code>DEFAULT=/var/spool/mail/itroot<br />
MAILDIR=$HOME/Mail<br />
<code></code><br />
:0<br />
* ^Subject:.*\[SMS\].*<br />
| cat - | awk -F":” ‘$1 == “Subject” { for(i=2; i &lt;=$NF; i++) $(i-1) = $i; print $0 }’ | sudo /usr/bin/gnokii –sendsms 06XXXXXXXX &gt;&gt; /var/log/SMS.log 2&gt;&amp;1<br />
</code></p></blockquote>
<p>As you can see, due to permissions issue, itroot as been allowed to invoke gnokii using sudo without password. This implies the following line in <code>/etc/sudoers</code>:</p>
<blockquote><p><code>itroot ALL = NOPASSWD: /usr/bin/gnokii</code></p></blockquote>
<p>More over, a log file has been created with write permission for itroot user: <code>/var/log/SMS.log"</code>. This log file will allow you to make sure that gnokii is doing its job <img src='http://linux.wxs.ro/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><a href="http://blog.mc-thias.org/?title=mail_to_sms_using_procmail&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1">source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://linux.wxs.ro/2012/01/12/mail-to-sms-using-procmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export the privileges from MySQL and then import to a new server</title>
		<link>http://linux.wxs.ro/2011/12/29/export-the-privileges-from-mysql-and-then-import-to-a-new-server/</link>
		<comments>http://linux.wxs.ro/2011/12/29/export-the-privileges-from-mysql-and-then-import-to-a-new-server/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 12:19:01 +0000</pubDate>
		<dc:creator>WladyX</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://linux.wxs.ro/?p=1785</guid>
		<description><![CDATA[.bashrc: mygrants() { mysql -B -N $@ -e "SELECT DISTINCT CONCAT( 'SHOW GRANTS FOR ''', user, '''@''', host, ''';' ) AS query FROM mysql.user" &#124; \ mysql $@ &#124; \ sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}' } mygrants --host=prod-db1 --user=admin --password=secret &#124; grep rails_admin &#124; mysql --host=staging-db1 --user=admin --password=secret mygrants --password=xxx&#62; /mysql.grant source]]></description>
			<content:encoded><![CDATA[<p>.bashrc:<br />
<code>mygrants()<br />
{<br />
mysql -B -N $@ -e "SELECT DISTINCT CONCAT(<br />
'SHOW GRANTS FOR ''', user, '''@''', host, ''';'<br />
) AS query FROM mysql.user" | \<br />
mysql $@ | \<br />
sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}'<br />
}</code></p>
<p><code>mygrants --host=prod-db1 --user=admin --password=secret | grep rails_admin | mysql --host=staging-db1 --user=admin --password=secret</code><br />
<code>mygrants --password=xxx&gt; /mysql.grant</code></p>
<p><a href="http://serverfault.com/questions/8860/how-can-i-export-the-privileges-from-mysql-and-then-import-to-a-new-server">source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://linux.wxs.ro/2011/12/29/export-the-privileges-from-mysql-and-then-import-to-a-new-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bash script to batch convert .wav to .mp3</title>
		<link>http://linux.wxs.ro/2011/11/29/bash-script-to-batch-convert-wav-to-mp3/</link>
		<comments>http://linux.wxs.ro/2011/11/29/bash-script-to-batch-convert-wav-to-mp3/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 13:55:28 +0000</pubDate>
		<dc:creator>WladyX</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://linux.wxs.ro/?p=1741</guid>
		<description><![CDATA[#!/bin/bash LAMEOPTS="-V 1" for FILE in *.wav ; do OUTNAME="${FILE%%.wav}.mp3" lame $LAMEOPTS "$FILE" "$OUTNAME" done source]]></description>
			<content:encoded><![CDATA[<p><code>#!/bin/bash<br />
LAMEOPTS="-V 1"</code></p>
<p><code>for FILE in *.wav ; do<br />
OUTNAME="${FILE%%.wav}.mp3"<br />
lame $LAMEOPTS "$FILE" "$OUTNAME"<br />
done</code></p>
<p><a href="http://www.linuxquestions.org/questions/slackware-14/need-a-bash-script-to-batch-convert-wav-to-mp3-555911/page2.html">source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://linux.wxs.ro/2011/11/29/bash-script-to-batch-convert-wav-to-mp3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>find mtime</title>
		<link>http://linux.wxs.ro/2011/11/23/find-mtime/</link>
		<comments>http://linux.wxs.ro/2011/11/23/find-mtime/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 15:36:59 +0000</pubDate>
		<dc:creator>WladyX</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://linux.wxs.ro/?p=1734</guid>
		<description><![CDATA[find . -mtime 0 # find files modified between now and 1 day ago # (i.e., within the past 24 hours) find . -mtime -1 # find files modified less than 1 day ago # (i.e., within the past 24 hours, as before) find . -mtime 1 # find files modified between 24 and 48 [...]]]></description>
			<content:encoded><![CDATA[<p>find . -mtime 0 # find files modified between now and 1 day ago<br />
# (i.e., within the past 24 hours)<br />
find . -mtime -1 # find files modified less than 1 day ago<br />
# (i.e., within the past 24 hours, as before)<br />
find . -mtime 1 # find files modified between 24 and 48 hours ago<br />
find . -mtime +1 # find files modified more than 48 hours ago</p>
<p>find . -mmin +5 -mmin -10 # find files modified between<br />
# 6 and 9 minutes ago</p>
<p><a href="http://content.hccfl.edu/pollock/unix/findcmd.htm">source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://linux.wxs.ro/2011/11/23/find-mtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmatically open tab in gnome-terminal, execute command, and have tab stay open</title>
		<link>http://linux.wxs.ro/2011/09/28/programmatically-open-tab-in-gnome-terminal-execute-command-and-have-tab-stay-open/</link>
		<comments>http://linux.wxs.ro/2011/09/28/programmatically-open-tab-in-gnome-terminal-execute-command-and-have-tab-stay-open/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 13:17:05 +0000</pubDate>
		<dc:creator>WladyX</dc:creator>
				<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://linux.wxs.ro/?p=1625</guid>
		<description><![CDATA[cat /usr/local/bin/run-in-new-tab #! /bin/bash window=&#8221;$(xdotool search &#8211;class gnome-terminal &#124; head -1)&#8221; xdotool windowfocus $window xdotool key shift+Up xdotool type &#8220;$*&#8221; xdotool key Return source]]></description>
			<content:encoded><![CDATA[<p><code>cat /usr/local/bin/run-in-new-tab<br />
#! /bin/bash</code></p>
<p>window=&#8221;$(xdotool search &#8211;class gnome-terminal | head -1)&#8221;<br />
xdotool windowfocus $window<br />
xdotool key shift+Up<br />
xdotool type &#8220;$*&#8221;<br />
xdotool key Return</p>
<p><a href="http://superuser.com/questions/178617/programmatically-open-tab-in-gnome-terminal-execute-command-and-have-tab-stay-o">source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://linux.wxs.ro/2011/09/28/programmatically-open-tab-in-gnome-terminal-execute-command-and-have-tab-stay-open/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>server_info.sh</title>
		<link>http://linux.wxs.ro/2011/09/21/server_info-sh/</link>
		<comments>http://linux.wxs.ro/2011/09/21/server_info-sh/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 09:49:26 +0000</pubDate>
		<dc:creator>WladyX</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://linux.wxs.ro/?p=1601</guid>
		<description><![CDATA[#! /bin/bash ssh $1 -l root "cat /etc/*-release&#124;&#124;cat /etc/slackware-version&#038;&#038; dmidecode &#124;grep 'Product Name'&#038;&#038;uname -a&#038;&#038;cat /proc/cpuinfo&#124;egrep 'processor&#124;model name'&#038;&#038;free -m"]]></description>
			<content:encoded><![CDATA[<p><code>#! /bin/bash<br />
ssh $1 -l root "cat /etc/*-release||cat /etc/slackware-version&#038;&#038; dmidecode |grep 'Product Name'&#038;&#038;uname -a&#038;&#038;cat /proc/cpuinfo|egrep 'processor|model name'&#038;&#038;free -m"</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linux.wxs.ro/2011/09/21/server_info-sh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grep OR</title>
		<link>http://linux.wxs.ro/2011/09/21/grep-or/</link>
		<comments>http://linux.wxs.ro/2011/09/21/grep-or/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 07:15:25 +0000</pubDate>
		<dc:creator>WladyX</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://linux.wxs.ro/?p=1599</guid>
		<description><![CDATA[cat /proc/cpuinfo &#124;egrep 'processor&#124;model name']]></description>
			<content:encoded><![CDATA[<p><code>cat /proc/cpuinfo |egrep 'processor|model name'</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linux.wxs.ro/2011/09/21/grep-or/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find and remove old big mails from maildir</title>
		<link>http://linux.wxs.ro/2011/08/10/find-and-remove-old-big-mails-from-maildir/</link>
		<comments>http://linux.wxs.ro/2011/08/10/find-and-remove-old-big-mails-from-maildir/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 14:36:13 +0000</pubDate>
		<dc:creator>WladyX</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://linux.wxs.ro/?p=1564</guid>
		<description><![CDATA[#! /bin/bash for i in `ls /home/` find /home/$i/Maildir/*/* -type f -size +8192k -mtime +0 -exec grep -il "^Subject: test subject" {} \; -exec rm -f {} \; done]]></description>
			<content:encoded><![CDATA[<p><code>#! /bin/bash<br />
for i in `ls /home/`<br />
find /home/$i/Maildir/*/* -type f -size +8192k -mtime +0 -exec grep -il "^Subject: test subject" {} \; -exec rm -f {} \;<br />
done</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linux.wxs.ro/2011/08/10/find-and-remove-old-big-mails-from-maildir/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

