<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>The Linux Daily</title>
	
	<link>http://www.thelinuxdaily.com</link>
	<description>Tutorials, Guides, Tips, and Tricks from Everyday Experiences</description>
	<lastBuildDate>Wed, 20 Mar 2013 14:50:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TheLinuxDaily" /><feedburner:info uri="thelinuxdaily" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>TheLinuxDaily</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Attn Subscribers:  Google Reader Being Shutdown</title>
		<link>http://feedproxy.google.com/~r/TheLinuxDaily/~3/l4NG5Hmp2yk/</link>
		<comments>http://www.thelinuxdaily.com/2013/03/attn-subscribers-google-reader-being-shutdown/#comments</comments>
		<pubDate>Wed, 20 Mar 2013 14:44:10 +0000</pubDate>
		<dc:creator>Derek@TheDailyLinux</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.thelinuxdaily.com/?p=2746</guid>
		<description><![CDATA[Google announced March 13th that it&#8217;s going through some more spring cleaning which includes Google Reader (see http://googleblog.blogspot.com/2013/03/a-second-spring-of-cleaning.html and http://googlereader.blogspot.com/2013/03/powering-down-google-reader.html). I&#8217;d like to remind my subscribers, of which 90% or so are using Reader or iGoogle, may need to resubscribe or transfer their subscription to iGoogle or another feed reader. You should be able to [...]]]></description>
				<content:encoded><![CDATA[<p>Google announced March 13th that it&#8217;s going through some more spring cleaning which includes Google Reader (see <a href="http://googleblog.blogspot.com/2013/03/a-second-spring-of-cleaning.html" title="http://googleblog.blogspot.com/2013/03/a-second-spring-of-cleaning.html" target="_blank">http://googleblog.blogspot.com/2013/03/a-second-spring-of-cleaning.html</a> and <a href="http://googlereader.blogspot.com/2013/03/powering-down-google-reader.html" title="http://googlereader.blogspot.com/2013/03/powering-down-google-reader.html" target="_blank">http://googlereader.blogspot.com/2013/03/powering-down-google-reader.html</a>).  I&#8217;d like to remind my subscribers, of which 90% or so are using Reader or iGoogle, may need to resubscribe or transfer their subscription to iGoogle or another feed reader.  You should be able to click the <a href="http://feeds.feedburner.com/TheLinuxDaily">RSS Feed</a> link and choose an RSS reader.  Thanks for your continued support!</p>
<img src="http://feeds.feedburner.com/~r/TheLinuxDaily/~4/l4NG5Hmp2yk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxdaily.com/2013/03/attn-subscribers-google-reader-being-shutdown/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.thelinuxdaily.com/2013/03/attn-subscribers-google-reader-being-shutdown/</feedburner:origLink></item>
		<item>
		<title>Tutorial: Installing Django on Shared Hosting Service Such as Bluehost.com</title>
		<link>http://feedproxy.google.com/~r/TheLinuxDaily/~3/aK8alk2kL1c/</link>
		<comments>http://www.thelinuxdaily.com/2012/12/tutorial-installing-django-on-shared-hosting-service-such-as-bluehost-com/#comments</comments>
		<pubDate>Fri, 07 Dec 2012 14:00:59 +0000</pubDate>
		<dc:creator>Derek@TheDailyLinux</dc:creator>
				<category><![CDATA[Tutorials and Guides]]></category>

		<guid isPermaLink="false">http://www.thelinuxdaily.com/?p=2716</guid>
		<description><![CDATA[This guide will walk you through how to install and run Django on a shared host such as Bluehost. Because I use Bluehost, I was able to verify the steps you see below, but you might need to modify some of the steps to work with your specific host. The whole thing should take less [...]]]></description>
				<content:encoded><![CDATA[<p>This guide will walk you through how to install and run Django on a shared host such as Bluehost.  Because I use Bluehost, I was able to verify the steps you see below, but you <em>might</em> need to modify some of the steps to work with your specific host.  The whole thing should take less than 10 minutes.  If I&#8217;ve done my job right, you should be able to copy/paste multiple lines to run all commands in a block as if it were a script.  If you feel more comfortable, you can run each command line by line.  Let&#8217;s get to it&#8230;</p>
<p><span id="more-2716"></span></p>
<h3><span style="color: #800000;">Step 1: Installing Python 2.7</span></h3>
<p>This step is for those of you who have an older installation of Python on your webhost.  In the case of Bluehost (as of 12/6/2012), the version that is installed is 2.6.6.  If you have version 2.7.0 and up (but not including version 3.0), then you can skip this step.  Otherwise, follow along  (you should be able to copy/paste this entire block into the terminal to run it all at once):</p>
<pre>
cd ~
mkdir python27
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar xf Python-2.7.3.tgz
cd Python-2.7.3/
./configure -prefix=$HOME/python27/ --enable-unicode=ucs4
make &#038;&#038; make install
mv ~/python27/bin/python ~/python27/bin/python27
echo "PATH=\$PATH:\$HOME/python27/bin" >> ~/.bashrc
echo "export LC_ALL=en_US.UTF-8" >> ~/.bashrc
echo "export LANG=en_US.UTF-8" >> ~/.bashrc
. ~/.bashrc
</pre>
<p>At this point, you should be able to run <code>which python27</code> successfully like this:</p>
<pre>
# which python27
/home1/user/python27/bin/python27
</pre>
<h3><span style="color: #800000;">Step 2: Installing SetupTools and PIP</span></h3>
<p>Now that Python 2.7 has been installed, we&#8217;ll need to install setuptools and pip (you should be able to copy/paste this entire block into the terminal to run it all at once):</p>
<pre>
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar xf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python27 setup.py install
cd ~
wget http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz
tar xf pip-1.1.tar.gz
cd pip-1.1
python27 setup.py install
</pre>
<p>At this point, you should be able to run <code>which pip</code> successfully like this:</p>
<pre>
# which pip
/home1/user/python27/bin/pip
</pre>
<h3><span style="color: #800000;">Step 3: Use <code>pip</code> to Install Modules</span></h3>
<p>We&#8217;re going to install MySQL-python, flup, and Django using pip (Note: If you plan on using PosgreSQL, you&#8217;ll need to install psycopg2):</p>
<pre>
pip install Django MySQL-python flup #psycopg2
</pre>
<p>At this point, you should be able to run <code>which django-admin.py</code> successfully like this:</p>
<pre>
# which django-admin.py
/home1/user/python27/bin/django-admin.py
</pre>
<h3><span style="color: #800000;">Step 4: Setup an Environment for the Project</span></h3>
<p>I&#8217;m going to name the project &#8216;myproject&#8217;.  When you go to create your own, you&#8217;ll want to replace anything called &#8216;myproject&#8217; with the project name of your choice (you should be able to copy/paste this entire block into the terminal to run it all at once):</p>
<pre>
mkdir ~/public_html/myproject
cd ~/public_html/myproject

cat &gt; myproject.fcgi &lt;&lt; EOF
#!$HOME/python27/bin/python27
import sys, os
project_name = &quot;myproject&quot;

# Add a custom Python path.
sys.path.insert(0, os.path.expanduser(&quot;~&quot;) + &quot;/python27&quot;)
sys.path.insert(13, os.getcwd() + &quot;/&quot; + project_name)

os.environ[&#039;DJANGO_SETTINGS_MODULE&#039;] = project_name + &#039;.settings&#039;
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method=&quot;threaded&quot;, daemonize=&quot;false&quot;)
EOF

cat &gt; .htaccess &lt;&lt; EOF
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ myproject.fcgi/$1 [QSA,L]
EOF

chmod 0755 myproject.fcgi

</pre>
<h3><span style="color: #800000;">Step 4: Create the Django Project</span></h3>
<p>Lastly, we&#8217;re going to use django-admin to start our project called &#8216;myproject&#8217; making sure to be in the correct directory first:</p>
<pre>
cd ~/public_html/myproject/
django-admin.py startproject myproject
</pre>
<p>Now, visit your website at http://mydomain/myproject and you should see the Django start page!  Have fun with it.</p>
<p><a href="http://www.thelinuxdaily.com/wp-content/uploads/2012/12/django_worked.png"><img src="http://www.thelinuxdaily.com/wp-content/uploads/2012/12/django_worked.png" alt="" title="django_worked" width="575" height="284" class="alignnone size-full wp-image-2718" /></a></p>
<p>A final note:  If you want to use the admin pages, you&#8217;ll need to follow a few more steps to get the page to show up properly with css, js, and images (you&#8217;ll need to replace <em>mydomainname</em> with your actual domain name).</p>
<pre>
ln -s $HOME/python27/lib/python2.7/site-packages/django/contrib/admin/static $HOME/public_html/myproject/static
sed -i "s/^STATIC_ROOT = ''/STATIC_ROOT = 'admin'/g" $HOME/public_html/myproject/myproject/myproject/settings.py
sed -i "s/^STATIC_URL = ''/STATIC_URL = 'http:\/\/mydomainname.com\/myproject\/static'/g" $HOME/public_html/myproject/myproject/myproject/settings.py
</pre>
<p>Sources: <a href="http://simplyargh.blogspot.com/2012/04/python-27-django-14-on-bluehost.html" title="simplyargh blog" target="_blank">Simply Argh Blog</a></p>
<img src="http://feeds.feedburner.com/~r/TheLinuxDaily/~4/aK8alk2kL1c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxdaily.com/2012/12/tutorial-installing-django-on-shared-hosting-service-such-as-bluehost-com/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.thelinuxdaily.com/2012/12/tutorial-installing-django-on-shared-hosting-service-such-as-bluehost-com/</feedburner:origLink></item>
		<item>
		<title>Handy Terminal Keyboard Shortcuts</title>
		<link>http://feedproxy.google.com/~r/TheLinuxDaily/~3/kr-KdtCdank/</link>
		<comments>http://www.thelinuxdaily.com/2012/12/handy-terminal-keyboard-shortcuts/#comments</comments>
		<pubDate>Wed, 05 Dec 2012 21:18:39 +0000</pubDate>
		<dc:creator>Derek@TheDailyLinux</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.thelinuxdaily.com/?p=2707</guid>
		<description><![CDATA[Put these into your &#8220;Terminal Guru&#8221; belt and be more productive! Cursor Movement Control Ctrl-a: Move cursor to the start of a line Ctrl-e: Move cursor to the end of a line Ctrl-Left/Right: Navigate word by word (may not work in all terminals) Modify Text Ctrl-w: Delete the whole word to the left of the [...]]]></description>
				<content:encoded><![CDATA[<p>Put these into your &#8220;Terminal Guru&#8221; belt and be more productive!</p>
<p><strong>Cursor Movement Control</strong><br />
<em>Ctrl-a</em>: Move cursor to the start of a line<br />
<em>Ctrl-e</em>: Move cursor to the end of a line<br />
<em>Ctrl-Left/Right</em>: Navigate word by word (may not work in all terminals)</p>
<p><strong>Modify Text</strong><br />
<em>Ctrl-w</em>: Delete the whole word to the left of the cursor<br />
<em>Ctrl-k</em>: Erase to end of line<br />
<em>Ctrl-u</em>: Erase to beginning of line</p>
<p><strong>Scrolling/Buffer Control</strong><br />
<em>Shift-PageUp/PageDown</em>: Scroll through current buffer<br />
<em>Ctrl-s</em>: Pause terminal output (program will keep running)<br />
<em>Ctrl-q</em>: Release terminal output (after being paused)<br />
<em>Ctrl-l</em>: Clears the screen. Use this instead of the clear command.</p>
<p><strong>History</strong><br />
<em>Ctrl-r</em>: Search the history (enter to run the command once found)</p>
<p>Bonus Tip: Use &#8216;!!&#8217; command to run last command and &#8216;!com&#8217; to run the last command starting with &#8216;com&#8217;.</p>
<p><strong>Process Control</strong><br />
<em>Ctrl-d</em>: Exit<br />
<em>Ctrl-c</em>: Kill the current process<br />
<em>Ctrl-z</em>: Put the current process in the background (fg will restore it)</p>
<p>Are there any keyboard shortcuts that you can&#8217;t live without?  Tell us about them in the comments below.</p>
<img src="http://feeds.feedburner.com/~r/TheLinuxDaily/~4/kr-KdtCdank" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxdaily.com/2012/12/handy-terminal-keyboard-shortcuts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.thelinuxdaily.com/2012/12/handy-terminal-keyboard-shortcuts/</feedburner:origLink></item>
		<item>
		<title>msmtp – a (fairly) simple mail submission program</title>
		<link>http://feedproxy.google.com/~r/TheLinuxDaily/~3/I4BIYc0Y5OM/</link>
		<comments>http://www.thelinuxdaily.com/2012/11/msmtp-a-fairly-simple-mail-submission-program/#comments</comments>
		<pubDate>Sun, 04 Nov 2012 15:23:20 +0000</pubDate>
		<dc:creator>Jim@TheDailyLinux</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.thelinuxdaily.com/?p=2696</guid>
		<description><![CDATA[As an oldtime Unix guy, I&#8217;ve always been used to having the BSD mail utility to hand, and a suitably configured mail system, so that I can script jobs to run and email the results back to me. I use mail as a sort of glorified syslog facility. With smaller single board Linux computers we [...]]]></description>
				<content:encoded><![CDATA[<p>As an oldtime Unix guy, I&#8217;ve always been used to having the BSD mail utility to hand, and a suitably configured mail system, so that I can script jobs to run and email the results back to me. I use mail as a sort of glorified syslog facility. With smaller single board Linux computers we don&#8217;t always want to install a full mail setup &#8211; resources often tend to be limited. A few years back I discovered msmtp <a href="http://msmtp.sourceforge.net/">http://msmtp.sourceforge.net/</a>. </p>
<p>This utility is an smtp client that submits a file in standard mail format to a mail server. It can submit plain text email or use TLS/SSL etc. I use a couple of script wrappers to emulate, sort of, sendmail and the sending part of the BSD mail utility.</p>
<p>Of course to use msmtp you need a mail server to which you can submit email for delivery. My home server is my mail server, but you could use your ISP&#8217;s smtp server. Another problem is that msmtp just fails if it can&#8217;t connect to the mail server &#8211; it&#8217;s up to you to handle that and do something else with that precious message you can&#8217;t mail just now! My sample scripts do not deal with that situation.</p>
<p>This very simple script I call <strong>sendmail</strong>, and it will need customising for your setup&#8230;</p>
<pre>
#!/bin/sh
#

# set these for your setup...
MailServer=mail.server
Domain=MachineName
From="me\@my.domain.com"

exec msmtp --host=$MailServer --domain=$Domain --from=$From $*
</pre>
<p>This is my simple script to emulate the simple parts of the send functionality in the BSD <strong>mail</strong> utility. It has many shortcomings, but it has served me well&#8230;</p>
<pre>
#!/bin/sh
#
# A sort of shell replacment for the send functionality of
# the standard "mail" utility.
#
# mail [-s subject] recipient(s)
#

u=`id -un`
d="my.email.domain"
r=""
s=""
v=""

while [ $# -gt 0 ]; do
 p="$1"
 shift
 case "$p" in
 -s)
        s="$1"
        if [ $# -gt 0 ]; then shift ; fi
        ;;
 -v)
        v="-d"
        ;;
 -*)
        echo 1&gt;&amp;2 "Option \"$p\" not recognised."
        exit 1
        ;;
 *)
        r="$r , $p"
        ;;
 esac
done
if [ "$r" = "" ]; then
 echo 1&gt;&amp;2 "No Recipients."
 exit 1
fi
if [ "$s" = "" ]; then
 printf "Subject: "
 read s
fi

s="Subject: $s \n"

(echo -e "From: ${u}@$d \nTo: $r \n$s \n\n"
 cat ) | sendmail -t $v

</pre>
<p>So if you have a job to run on the platform, then this will email the output to you&#8230;</p>
<p>   my_job | mail -s &#8220;my_job output&#8221; me@my.email.add</p>
<p><strong>msmtp</strong> can be loaded from the package systems of most distributions, but I have had occasion to cross-compile the package for installing on a system without package management. I had only limited libraries on my cross compile system, and found that after downloading and extracting the sourcecode from sourceforge, I had to cross compile without some of the advanced features. I used</p>
<p>  ./configure &#8211;build=arm  &#8211;disable-ssl &#8211;disable-gsasl &#8211;disable-nls</p>
<p>before doing the <em>make</em> to build the binaries. The resultant binary just submitted plain text email, but that was ok for my use &#8211; YMMV. The resultant binary, suitably stripped,is pretty lean.</p>
<p>I recently revisited using <strong>msmtp</strong> to pre-test a change to my ISP&#8217;s new smtp server, before committing the change to my mailserver&#8217;s <strong>sendmail</strong> setup. It can also be useful for testing security settings etc on mail submissions systems.</p>
<p>Jim</p>
<img src="http://feeds.feedburner.com/~r/TheLinuxDaily/~4/I4BIYc0Y5OM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxdaily.com/2012/11/msmtp-a-fairly-simple-mail-submission-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.thelinuxdaily.com/2012/11/msmtp-a-fairly-simple-mail-submission-program/</feedburner:origLink></item>
		<item>
		<title>Kermit lives!</title>
		<link>http://feedproxy.google.com/~r/TheLinuxDaily/~3/pZO9wW_8C64/</link>
		<comments>http://www.thelinuxdaily.com/2012/10/kermit-lives/#comments</comments>
		<pubDate>Thu, 18 Oct 2012 19:58:06 +0000</pubDate>
		<dc:creator>Jim@TheDailyLinux</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.thelinuxdaily.com/?p=2682</guid>
		<description><![CDATA[As a veteran of the IT industry I&#8217;ve seen software and OSes come and go, but there are some pieces of software that I seem to have used on a lot of platforms for a lot of years. One of the oldest of these is the file transfer software Kermit, from Columbia University &#8211; http://www.columbia.edu/kermit/ [...]]]></description>
				<content:encoded><![CDATA[<p>As a veteran of the IT industry I&#8217;ve seen software and OSes come and go, but there are some pieces of software that I seem to have used on a lot of platforms for a lot of years. One of the oldest of these is the file transfer software <strong>Kermit</strong>, from Columbia University &#8211; <a href="http://www.columbia.edu/kermit/">http://www.columbia.edu/kermit/</a></p>
<p>I&#8217;ve used kermit in the early 80&#8242;s, on various CP/M systems, the very first IBM PCs and on the BBC Micro, and have been using it since on various early Unices, and other OSes that are now only memories in old fogy minds like mine. I even used hacked versions of kermit for building an email system between various computers joined by rs232 links, and then gatewayed out to the big wide world in the late 1980&#8242;s.</p>
<p>I used it extensively in the 90&#8242;s for automating and controlling transfers and connections over dial-up modems. It is still my console of choice when I need to hook up microcontrollers and single board computers with rs232. It&#8217;s configurability, features and programmability make it second to none.</p>
<p>However it has always erked me that it&#8217;s licensing prevented it being available in the standard repositories of the major Linux distributions. I have got used to downloading the source tar ball and compiling my own executables whenever I&#8217;ve needed kermit, and cursed silently that yum or apt-get would not simply do the job for me.</p>
<p>So imagine my joy when I belatedly discovered that Columbia University have cancelled the Kermit project and allowed it to be re-licensed and development continue at <a href="http://www.kermitproject.org/">http://www.kermitproject.org/</a>. The new license is a Revised 3-Clause BSD License which will at last allow Kermit to join the Free Software Family as a full member &#8211; and about time too!</p>
<p>If you are not familiar with Kermit, and need to go beyond where minicom etc can take you, then do check it out. It might appear a bit old school but it is very, very powerfull.</p>
<p>Jim</p>
<img src="http://feeds.feedburner.com/~r/TheLinuxDaily/~4/pZO9wW_8C64" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxdaily.com/2012/10/kermit-lives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.thelinuxdaily.com/2012/10/kermit-lives/</feedburner:origLink></item>
		<item>
		<title>Resuming stalled or held CUPS print jobs…</title>
		<link>http://feedproxy.google.com/~r/TheLinuxDaily/~3/O5EqyhhYC9A/</link>
		<comments>http://www.thelinuxdaily.com/2012/10/resuming-stalled-or-held-cups-print-jobs/#comments</comments>
		<pubDate>Thu, 11 Oct 2012 10:32:49 +0000</pubDate>
		<dc:creator>Jim@TheDailyLinux</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.thelinuxdaily.com/?p=2674</guid>
		<description><![CDATA[I have a network printer, and it&#8217;s surprising how often I print a job and then find the printer is not switched on, and the print job gets put in HOLD state. Using &#8220;lpstat -l&#8221; one can view the print job status, and with the &#8220;lp&#8221; command can resume the print job. But I&#8217;m idle, [...]]]></description>
				<content:encoded><![CDATA[<p>I have a network printer, and it&#8217;s surprising how often I print a job and then find the printer is not switched on, and the print job gets put in HOLD state. Using &#8220;lpstat -l&#8221; one can view the print job status, and with the &#8220;lp&#8221; command can resume the print job. But I&#8217;m idle, so I created this very simple script to do it all in one command &#8211; I call it &#8220;lprel&#8221;.</p>
<pre>
#!/bin/sh
#
# script to resume the top job on the default printer queue

j=`lpstat | head -1 | cut -d' ' -f1`
if [ "$j" = "" ]; then
  echo 1&gt;&amp;2 "No jobs in queue."
  exit 1
fi
echo "releasing \"$j\"..."
lp -i "$j" -H resume
lpstat -l

</pre>
<p>cheers<br />
Jim</p>
<img src="http://feeds.feedburner.com/~r/TheLinuxDaily/~4/O5EqyhhYC9A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxdaily.com/2012/10/resuming-stalled-or-held-cups-print-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.thelinuxdaily.com/2012/10/resuming-stalled-or-held-cups-print-jobs/</feedburner:origLink></item>
		<item>
		<title>Linux Motherboard upgrade</title>
		<link>http://feedproxy.google.com/~r/TheLinuxDaily/~3/IuMikVpAsQo/</link>
		<comments>http://www.thelinuxdaily.com/2012/09/linux-motherboard-upgrade/#comments</comments>
		<pubDate>Mon, 24 Sep 2012 11:13:20 +0000</pubDate>
		<dc:creator>Jim@TheDailyLinux</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.thelinuxdaily.com/?p=2661</guid>
		<description><![CDATA[I&#8217;ve always been pretty amazed at how easy it is to change hardware under a Linux system and for it mostly to just work &#8211; especially with most modern distros. Unlike those that are stuck with Windows systems, it is possible to do a motherboard upgrade on a linux system with the minimum of fuss, [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve always been pretty amazed at how easy it is to change hardware under a Linux system and for it mostly to just work &#8211; especially with most modern distros. Unlike those that are stuck with Windows systems, it is possible to do a motherboard upgrade on a linux system with the minimum of fuss, and without doing a system install! </p>
<p>Indeed, mostly it&#8217;s just a matter of remembering to make the system forget about the MAC address of the on-board ethernet. Otherwise after the system is booted, the system thinks that the <strong>eth0</strong> is missing and instead configures the hardware as <strong>eth1</strong>.</p>
<p>Maybe networkmanager, or whatever, copes, but I like to have command-line control over my network setup, and on my Debian based systems it&#8217;s <strong>eth0</strong> that is configured properly in <strong>/etc/network/interfaces</strong>.</p>
<p>So before I shut down my old motherboard system for the last time, I delete the <strong>eth0</strong> line in the file <strong>/etc/udev/rules.d/70-persistent-net.rules</strong> so that when the system reboots with new hardware, it allocates <strong>eth0</strong> to the new onboard ethernet interface.</p>
<p>However, I recently recycled an Intel D945GSEJT motherboard as a replacement for a VIA EPIA MoBo in my home server. The Intel board had been my guts of my desktop before I upgraded to a dual core ATOM based board &#8211; I like my hardware to use less Watts. My server runs Ubuntu server 8.04 LTS, and, despite the forced amnesia of the VIA&#8217;s ethernet MAC address, I still didn&#8217;t have an ethernet connection after the Motherboard transplant. A quick google discovered a load of issues with Realtek r8169 driver in older kernels &#8211; and Ubuntu Server 8.04 LTS is hardly state of the art.</p>
<p>Not having time to do a real fix, I reached for an old PCI Ethernet card I sometimes used when I needed a machine with 2 ethernet ports. Remembering to hack <strong>/etc/udev/rules.d/70-persistent-net.rules</strong>, disabling the onboard ethernet device in the BIOS and rebooting immediately got me a working system. </p>
<p>I&#8217;ll leave it like it is until after I get up the courage to do the upgrade to Ubuntu server 10.04LTS. Then I&#8217;ll rescue the PCI ethernet card and add it to my box of useful bits and pieces that might just get me out of a fix. That box has all sorts of cables and adapters, as well as an old PCI graphics card, a PCI SATA adapter, a PCI IDE adapter and the PCI Ethernet card. Anyone got recommendations for other useful bits and pieces to add to the box?</p>
<p>cheers<br />
Jim Jackson</p>
<img src="http://feeds.feedburner.com/~r/TheLinuxDaily/~4/IuMikVpAsQo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxdaily.com/2012/09/linux-motherboard-upgrade/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.thelinuxdaily.com/2012/09/linux-motherboard-upgrade/</feedburner:origLink></item>
		<item>
		<title>Self Documenting Scripts</title>
		<link>http://feedproxy.google.com/~r/TheLinuxDaily/~3/bLwZKcjYfbA/</link>
		<comments>http://www.thelinuxdaily.com/2012/09/self-documenting-scripts/#comments</comments>
		<pubDate>Tue, 18 Sep 2012 18:35:15 +0000</pubDate>
		<dc:creator>Jim@TheDailyLinux</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.thelinuxdaily.com/?p=2659</guid>
		<description><![CDATA[As a &#8220;good&#8221; programmer I like to put comments at the top of my scripts to say what the script does, and how it is used. I also like the script to output a useful help message when a user gets options/arguments wrong, or when they use the option &#8216;-h&#8217;. I found it was a [...]]]></description>
				<content:encoded><![CDATA[<p>As a &#8220;good&#8221; programmer I like to put comments at the top of my scripts to say what the script does, and how it is used. I also like the script to output a useful help message when a user gets options/arguments wrong, or when they use the option &#8216;-h&#8217;. I found it was a pain keeping the 2 in step, and developed this simple scheme to only have one place for this info.</p>
<p>I&#8217;ll use <strong>bash</strong> here but I&#8217;m sure people can adapt to other scripting languages.</p>
<pre>
#!/bin/sh
#
## 
## Usage: helpdemo 
##
## This demos a self documenting scheme for scripts.
##

prog="$0"
me=`basename "$prog"`

dohelp () {
  grep '^##' "$prog" | sed -e 's/^##//' -e "s/_PROG_/$me/" 1&gt;&amp;2
}

echo "Program name is: $me"
echo "Program file is: $prog"
echo

dohelp
exit
</pre>
<p>Prefix any lines you want to be output as &#8220;help&#8221; by &#8216;##&#8217; at the beginning of the line. All such lines are printed out to <strong>stderr</strong> by the <strong>dohelp</strong> function. &#8216;sed&#8217; in this function also strips off the leading &#8216;##&#8217; from the lines and substitutes the filename of the invoked script for &#8216;_PROG_&#8217;, so that if you change the name of the script, it still magically refers to the new name.</p>
<p>It&#8217;s a simple scheme, and can obviously be extended, e.g. one could change the <strong>dohelp</strong> function thus&#8230;</p>
<pre>

dohelp () {
  pfx="$1"
  if [ "$pfx" = "" ]; then pfx='##' ; fi
  grep "^$pfx" "$prog" | sed -e "s/^$pfx//" -e "s/_PROG_/$me/" 1&gt;&amp;2
}

</pre>
<p><strong>dohelp</strong> can now be called to select out lines with a different prefix, but its default behaviour when given no prefix, is as before.</p>
<p>This has formed part of my standard shell script template for many years. Hope others find it useful.</p>
<p>Jim Jackson</p>
<img src="http://feeds.feedburner.com/~r/TheLinuxDaily/~4/bLwZKcjYfbA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxdaily.com/2012/09/self-documenting-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.thelinuxdaily.com/2012/09/self-documenting-scripts/</feedburner:origLink></item>
		<item>
		<title>Roll your own ‘lsof’ – sort of</title>
		<link>http://feedproxy.google.com/~r/TheLinuxDaily/~3/M8h0xVX4z9E/</link>
		<comments>http://www.thelinuxdaily.com/2012/09/roll-your-own-lsof-sort-of/#comments</comments>
		<pubDate>Mon, 10 Sep 2012 11:18:30 +0000</pubDate>
		<dc:creator>Jim@TheDailyLinux</dc:creator>
				<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://www.thelinuxdaily.com/?p=2605</guid>
		<description><![CDATA[Ever read the &#8216;lsof&#8217; utility man page? It&#8217;s a shame, because the idea of the utility is wonderful &#8211; list open files and who is using them. I had need to see what files were in use by imapd on my server. &#8220;lsof &#124; grep imapd&#8221; gave me far more than I needed, along with [...]]]></description>
				<content:encoded><![CDATA[<p>Ever read the &#8216;lsof&#8217; utility man page? It&#8217;s a shame, because the idea of the utility is wonderful &#8211; list open files and who is using them.</p>
<p>I had need to see what files were in use by imapd on my server. &#8220;lsof | grep imapd&#8221; gave me far more than I needed, along with long lines of info I didn&#8217;t really need all of, and all the libraries in use, etc, etc. That&#8217;s when I thought, RTFM[1] &#8230; so I did, and eventually gave up. Maybe I was having a bad day, but the manual seemed impenetrable, so I turned to<br />
rolling my own.</p>
<p>I&#8217;d explored around the /proc file system a bit before, and was sure everything I need was there, and it turned out a lot easier than I&#8217;d thought. So here goes&#8230;</p>
<p>Under /proc, every process has a directory, with an entry called &#8220;cmdline&#8221; which gives access to that process&#8217;s command line arguments. There is a sub-directory called &#8220;fd&#8221; that contains links to each file the process has open. With this info I knocked together this little script, I called it &#8216;pof&#8217;:</p>
<pre>
#!/bin/sh
#
cd /proc
while [ "$1" != "" ]; do
  for n in [1-9]* ; do
    if [ "$n" != "self" -a -f $n/cmdline ] then
      if grep "$1" $n/cmdline &gt; /dev/null ; then
        cmd=`tr '&#092;0' ' ' &lt; $n/cmdline`
        printf "%-8d %s\n" $n "$cmd"
        for m in $n/fd/* ; do
          printf " %-14s %s %s\n" `stat --printf="%N" $m`
        done
      fi
    fi
  done
  shift
done
</pre>
<p>It is called with an string or regular expression that you want to search each command line for. If it is found, the open file links are displayed for that process. So now &#8216;pof imapd&#8217; gives me what I want.</p>
<p>The &#8216;cmdline&#8217; file contains each argument of the command line as a null (&#8216;&#092;0&#8242;) terminated string, so I need to use &#8216;tr&#8217; to convert the nulls to spaces before printing out.</p>
<p>On my system the imapd daemon is launched from inetd, so it&#8217;s first 3 files, stdin/stdout/stderr, are network sockets &#8211; so I need to dig a bit deeper and find out how to get the remote IP address of the socket.</p>
<p>Anyway I&#8217;m sure someone will tell me how easy &#8216;lsof&#8217; is to use to get any info you want, but delving into /proc is fun!</p>
<p>Jim Jackson</p>
<p>[1] <a href="http://en.wikipedia.org/wiki/RTFM">//en.wikipedia.org/wiki/RTFM</a></p>
<img src="http://feeds.feedburner.com/~r/TheLinuxDaily/~4/M8h0xVX4z9E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxdaily.com/2012/09/roll-your-own-lsof-sort-of/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.thelinuxdaily.com/2012/09/roll-your-own-lsof-sort-of/</feedburner:origLink></item>
		<item>
		<title>Script to Watch for Changes to Disk and Run Script Immediately</title>
		<link>http://feedproxy.google.com/~r/TheLinuxDaily/~3/qm78k-8oQvM/</link>
		<comments>http://www.thelinuxdaily.com/2012/09/script-to-watch-for-changes-to-disk-and-run-script-immediately/#comments</comments>
		<pubDate>Fri, 07 Sep 2012 13:00:54 +0000</pubDate>
		<dc:creator>Derek@TheDailyLinux</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[inotify]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.thelinuxdaily.com/?p=2590</guid>
		<description><![CDATA[By utilizing inotifywait from the inotify-tools package, we can monitor changes to disk and immediately run a script or command on that file. No need for a cron job here&#8230; To install inotify-tools, we simply use apt-get (or yum, depending on your distro): sudo apt-get install inotify-tools Here is one example script which utilizes inotifywait: [...]]]></description>
				<content:encoded><![CDATA[<p>By utilizing <code>inotifywait</code> from the <code>inotify-tools</code> package, we can monitor changes to disk and immediately run a script or command on that file.  No need for a cron job here&#8230;</p>
<p>To install inotify-tools, we simply use <code>apt-get</code> (or <code>yum</code>, depending on your distro):</p>
<pre>
sudo apt-get install inotify-tools
</pre>
<p>Here is one example script which utilizes <code>inotifywait</code>:</p>
<pre>
#!/bin/sh

watch_dir="/media/md0/"
inotifywait -mr -e create -e delete -e modify --timefmt '%Y-%m-%dT%H%M%S' --format '%w;%f;%e;%T' "$watch_dir" | while IFS=';' read -r DIR FILE EVENT TIME; do

  echo "${EVENT} ${TIME}: ${DIR}${FILE} >> /home/user/watched

  case "$EVENT" in
    "CREATE"|"MODIFY")
      echo "Run create/modify script on file: ${DIR}${FILE}" >> /home/user/watched
      ;;
    "DELETE")
      echo "Run delete script on file: ${DIR}${FILE}" >> /home/user/watched
      ;;
  esac
done
</pre>
<p>Give your script a name, executable rights, and run it in the background.  For example:<br />
<code>chmod +x myscript.sh &#038;&#038; ./myscript.sh &#038;</code></p>
<p>Obviously, you&#8217;ll need to modify the script to fit your needs, but this should give you a jump start on your project.</p>
<p><strong>Note:</strong> There&#8217;s an infinite loop bug in the script above.  Remove the &#8216;modify&#8217; options and this will clear things up.  However, if you do that, then you&#8217;re really only looking for file creation or deletion.  You could add more conditionals to the script above to prevent the loop.  If anybody has a suggestion, I&#8217;d be happy to update the script.</p>
<p>Take this a step further by following my guide on <a href="http://www.thelinuxdaily.com/2010/01/automatically-start-a-script-at-linux-bootup/" target="_blank">Automatically Start a Script at Linux Bootup</a></p>
<img src="http://feeds.feedburner.com/~r/TheLinuxDaily/~4/qm78k-8oQvM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxdaily.com/2012/09/script-to-watch-for-changes-to-disk-and-run-script-immediately/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.thelinuxdaily.com/2012/09/script-to-watch-for-changes-to-disk-and-run-script-immediately/</feedburner:origLink></item>
	</channel>
</rss>
