<?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>Deadlypenguin &#187; Linux</title>
	<atom:link href="http://blog.deadlypenguin.com/blog/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.deadlypenguin.com/blog</link>
	<description>My notes and rants about tech things</description>
	<lastBuildDate>Thu, 20 May 2010 17:46:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Automatic backups with UDEV</title>
		<link>http://blog.deadlypenguin.com/blog/2009/09/25/automatic-backups-with-udev/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/09/25/automatic-backups-with-udev/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 15:04:04 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=117</guid>
		<description><![CDATA[I recently challenged myself to come up with a way to make udev automatically backup when you plug in a USB harddrive.  I did all my testing with a USB stick drive, but since they both show up as block devices to the kernel, it shouldn&#8217;t matter.
UDEV Rules
To start with, we need to set [...]]]></description>
			<content:encoded><![CDATA[<p>I recently challenged myself to come up with a way to make udev automatically backup when you plug in a USB harddrive.  I did all my testing with a USB stick drive, but since they both show up as block devices to the kernel, it shouldn&#8217;t matter.</p>
<p><strong>UDEV Rules</strong></p>
<p>To start with, we need to set up static naming for the storage device that you want to make into backup disk.  Start by plugging in the disk.  (Now I&#8217;m not using Gnome or KDE so I&#8217;m not sure what their automounter will do.  So, you might have to find a way to exclude it from the automounter.  We need to find out the &#8220;model&#8221; of the drive.  My udev rules are pretty basic, and will work since most people don&#8217;t have more than one the same model of USB drive laying around that they would use.  You can always modify the udev rules to work for you.</p>
<blockquote><p>udevadm info -a -p /sys/block/sdc | grep model</p></blockquote>
<p>Here we are looking at the block device sdc (which is what the kernel named it since we don&#8217;t have any udev rules yet).  This could change depending on how many block devices you currently have.  Now we take this information, and feed it into a udev rule.  I created a file <em>/etc/udev/rules.d/50-backup.rules</em> The name isn&#8217;t really important, however, the number 50- is.  That is the order in which it runs.  We want that number to be less than 90 so that hal doesn&#8217;t run first.  Inside that file, we have the following:</p>
<blockquote><p>KERNEL==&#8221;sd?1&#8243;, SUBSYSTEM==&#8221;block&#8221;, ATTRS{model}==&#8221;MODEL GOES HERE&#8221;, SYMLINK+=&#8221;backup&#8221;, RUN+=&#8221;/usr/local/bin/backup.sh&#8221;</p></blockquote>
<p>Replace &#8220;MODEL GOES HERE&#8221; with the output from the udevadm command</p>
<p><strong>The backup script</strong></p>
<p>Now we udev running our script <em>/usr/local/bin/backup.sh</em> we need to make that script</p>
<blockquote><pre>#!/bin/bash

NOTIFYUSER="pcon"
MAINDIR="/home/pcon/"
BACKUPDIR="/mnt/backup"

su $NOTIFYUSER alt-notify-send backup "Waiting for things to settle" 0
sleep 5

su $NOTIFYUSER alt-notify-send backup "Starting backup" 0
echo "$(date) - Mounting /dev/backup to $BACKUPDIR" &gt; /tmp/backup.log
mount /dev/backup $BACKUPDIR &gt;&gt; /tmp/backup.log 2&gt;&amp;1
echo "$(date) - Staring rsync of $MAINDIR to $BACKUPDIR" &gt;&gt; /tmp/backup.log
rsync -arvuz --inplace --delete $MAINDIR $BACKUPDIR &gt;&gt; /tmp/backup.log 2&gt;&amp;1
echo "$(date) - Mounting /dev/backup to $BACKUPDIR" &gt;&gt; /tmp/backup.log
umount $BACKUPDIR &gt;&gt; /tmp/backup.log 2&gt;&amp;1
su $NOTIFYUSER alt-notify-send backup "Backup completed" 0</pre>
</blockquote>
<p>We have a couple of things to setup here.  First we need to create /mnt/backup as root, and fill out the other variables in the top of the script.  Aslo, if we want notification in gnome, we need to make a notify-send work around.  Put the following in <em>/usr/local/bin/alt-notify-send</em></p>
<blockquote><pre>#!/bin/sh
user=`whoami`
pids=`pgrep -u $user gnome-panel`
title=$1
text=$2
timeout=$3

if [ -z "$title" ]; then
    echo You need to give me a title &gt;&amp;2
    exit 1
fi
if [ -z "$text" ]; then
     text=$title
fi
if [ -z "$timeout" ]; then
     timeout=60000
fi

for pid in $pids; do
    # find DBUS session bus for this session
    DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS \
    /proc/$pid/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//'`
    # use it
    DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \
    notify-send -u low -t $timeout "$title" "$text"
done</pre>
</blockquote>
<p>Now chmod +x the two scripts, and everything should be good to go.  You can download the scripts used in this post below:</p>
<ul>
<li><a href="http://deadlypenguin.com/code/udevBackups/50-backup.rules" target="_blank">50-backup.rules</a></li>
<li><a href="http://deadlypenguin.com/code/udevBackups/backup.sh" target="_blank">backup.sh</a></li>
<li><a href="http://deadlypenguin.com/code/udevBackups/alt-notify-send" target="_blank">alt-notify-send</a> (Taken from <a href="http://ubuntuforums.org/showthread.php?p=6889270#post6889270" target="_blank">here</a>)</li>
</ul>
<p><strong> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/09/25/automatic-backups-with-udev/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>External programs that update screen</title>
		<link>http://blog.deadlypenguin.com/blog/2009/09/18/external-programs-that-update-screen/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/09/18/external-programs-that-update-screen/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 21:12:36 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=111</guid>
		<description><![CDATA[Screen is a great tool, and it allows you do to alot of neat things.  One of my favorites is binding commands to key strokes.  So all you have to do is hit F5 and it will start something in the background.  Such as a build command.  The problem is, you either get no output, [...]]]></description>
			<content:encoded><![CDATA[<p>Screen is a great tool, and it allows you do to alot of neat things.  One of my favorites is binding commands to key strokes.  So all you have to do is hit F5 and it will start something in the background.  Such as a build command.  The problem is, you either get no output, or you get spam all over your screen.  Well I&#8217;ve finally found a way around that.  The answer lies in ANSI Privacy Messages.</p>
<p>In your .screenrc, make sure you have a place that will show messages.  If you start up screen and you see &#8220;New screen&#8230;&#8221; then you&#8217;ve got this.  Next add your script to your .screenrc</p>
<blockquote><p>bind -k k5 exec /home/pcon/bin/build_script.sh</p></blockquote>
<p>Now everything in your screen is ready to go.  Now, on to build_script.sh</p>
<blockquote><p>#!/bin/bash</p>
<p>echo -n -e &#8220;&#92;033^Starting Build&#92;033&#92;&#92;&#8221;</p>
<p># Do something here</p>
<p>echo -n -e &#8220;&#92;033^Ending Build&#92;033&#92;&#92;&#8221;</p></blockquote>
<p>That&#8217;s it.  Now your screen will display &#8220;Starting Build&#8221; and &#8220;Ending Build&#8221; on your display.  If the stuff in between happens too fast, you may only see your last message.  The key thing is that your message has to start with &#8220;&#92;033^&#8221;  and end with &#8220;&#92;033&#92;&#92;&#8221; otherwise you&#8217;ll loose your cursor.  And you have to have the -e on the echo so that it will interpret the octal codes correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/09/18/external-programs-that-update-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>irssi + mumbles == push notification goodness</title>
		<link>http://blog.deadlypenguin.com/blog/2009/08/31/irssi-mumbles-push-notification-goodness/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/08/31/irssi-mumbles-push-notification-goodness/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 19:12:32 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=106</guid>
		<description><![CDATA[One of the biggest problems with irssi is that if you run it on remote machine, it can be quite hard to get notifications.  For the past couple of years, I&#8217;ve been running a plugin called fnotify that writes notifications to a file, then using another script I read that file and print it out [...]]]></description>
			<content:encoded><![CDATA[<p>One of the biggest problems with irssi is that if you run it on remote machine, it can be quite hard to get notifications.  For the past couple of years, I&#8217;ve been running a plugin called fnotify that writes notifications to a file, then using another script I read that file and print it out with libnotify.  There are a couple of problems with this:</p>
<ol>
<li>libnotify is ugly</li>
<li>takes up diskspace if you don&#8217;t clear the queue</li>
<li>requires you to either have the script, or remember the ridiculously long command</li>
</ol>
<p>Well, these are things of the past.  Thanks to <a href="http://www.mumbles-project.org" target="_blank">mumbles</a>!</p>
<p>First install mumbles from yum (or source) then install the <a href="http://deadlypenguin.com/code/growlNotify/growlNotify.pl" target="_blank">irssi script</a>.  Make sure you change the <em>growl_server</em> and <em>growl_password</em> then you are good to go.  The script has a dependency on Net::GrowlNotify in perl.</p>
<p>The script uses irssi config variables so you can use /SET growl_server or /SET growl_password to set your growl server/password without having to load/unload the script.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/08/31/irssi-mumbles-push-notification-goodness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DVD player with xsessions</title>
		<link>http://blog.deadlypenguin.com/blog/2009/06/12/dvd-player-with-xsessions/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/06/12/dvd-player-with-xsessions/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 18:55:15 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[satellite]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=87</guid>
		<description><![CDATA[I&#8217;ve come across the need to simply the dvd playing process.  I&#8217;m having to set up a laptop to play a dvd and use a remote presenter control.  Now in the past I&#8217;ve just been in charge of this setup, and haven&#8217;t had to worry about explaining how to start it up for others.  This [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve come across the need to simply the dvd playing process.  I&#8217;m having to set up a laptop to play a dvd and use a remote presenter control.  Now in the past I&#8217;ve just been in charge of this setup, and haven&#8217;t had to worry about explaining how to start it up for others.  This time, I need to make it as user friendly as possible.  So, I&#8217;ve decided to do this with a couple of bash scripts and a couple of xsessions.<br />
<strong>Goals</strong></p>
<ul>
<li>Generic user with a generic password to hand to the person in charge</li>
<li>Ability to play dvd stored locally.  (Called presentation_dvd)</li>
<li>Ability to play any dvd inserted.</li>
<li>Require no user input except to choose <em>presentation_dvd</em> or <em>dvd</em></li>
</ul>
<p><strong>Preperation</strong></p>
<p>To get ready, we need to do a couple of things</p>
<ul>
<li>Create a presenter user</li>
<li>Install xine and xine-lib-extras-freeworld</li>
<li>Copy our presentation_dvd to an iso<br />
<blockquote><p>dd if=/dev/dvd of=/home/presenter/presentation_dvd.iso</p></blockquote>
</li>
</ul>
<p><strong>Xesssions</strong></p>
<p>Xsessions are what defines your window manager.  It&#8217;s what tells X11 what to run when you say Session-&gt;Gnome or Session-&gt;fluxbox.  These files are stored in <em>/usr/share/xsessions</em>.</p>
<blockquote><p>[Desktop Entry]<br />
Encoding=UTF-8<br />
Name=Presentation_DVD<br />
Comment=Start the presentation DVD<br />
Exec=/usr/local/bin/presentation_dvd<br />
Terminal=False</p>
<p>[Window Manager]<br />
SessionManaged=true</p></blockquote>
<p>This is our file in <em>/usr/share/xesssions/presentation_dvd.desktop</em> We then create one in <em>/usr/share/xesssions/dvd.desktop</em> and replace presentation_dvd with dvd.</p>
<p><strong>The Scripts</strong></p>
<p>Our /usr/local/bin/presentation_dvd looks like this:</p>
<blockquote><div class="codesnip-container" >#!bin/bash<br />
amixer set Master playback 100%<br />
xine -f -g &#8211;no-splash dvd:/home/presenter/presentation_dvd.iso</div>
</blockquote>
<p>This will turn the volume up to 100% and then start xine on the iso.  To exit, just right click and say exit.  This will take you back to the login screen.</p>
<p>Now to handle any dvd with the <em>/usr/local/bin/dvd</em></p>
<blockquote><div class="codesnip-container" >#!/bin/bash<br />
amixer set Master playback 100%<br />
xine -f -g<em> </em>&#8211;no-splash dvd://</div>
</blockquote>
<p>And the final touch, make them both executable</p>
<blockquote><p>chmod a+x /usr/local/bin/dvd /usr/local/bin/presentation_dvd</p></blockquote>
<p><em>NOTE:  The xine parameter is dash dash no dash splash.  The font I&#8217;m using doesn&#8217;t render two dashes well</em></p>
<p><em><br />
</em></p>
<p><strong>Usage</strong></p>
<p>From the login menu, choose your presenter user, and then choose the appropriate session at the bottom.  Then type in the password.  Like magic, everything should work.</p>
<p><strong>Potential problems</strong></p>
<p>If you don&#8217;t see your session in the list, you might have a typo in your xsession file</p>
<p>If one of the xine scripts don&#8217;t work, try logging into gnome and running the script from the command-line to see why.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/06/12/dvd-player-with-xsessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TF2 Server</title>
		<link>http://blog.deadlypenguin.com/blog/2009/04/24/tf2-server/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/04/24/tf2-server/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 14:27:11 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=79</guid>
		<description><![CDATA[Just setup a TF2 server following this article
In Fedora, you need to do the following as root before running any of the commands from the article
ln -s /usr/bin/gunzip /usr/bin/uncompress
Now.  To figure out how the server.cfg
]]></description>
			<content:encoded><![CDATA[<p>Just setup a TF2 server following <a href="http://tyspace.com/?p=27" target="_blank">this article</a></p>
<p>In Fedora, you need to do the following as root before running any of the commands from the article</p>
<blockquote><p>ln -s /usr/bin/gunzip /usr/bin/uncompress</p></blockquote>
<p>Now.  To figure out how the server.cfg</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/04/24/tf2-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mutt and Lynx</title>
		<link>http://blog.deadlypenguin.com/blog/2009/04/21/mutt-and-lynx/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/04/21/mutt-and-lynx/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 21:27:48 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mutt]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=76</guid>
		<description><![CDATA[So, in my time with mutt, I have grown to have a disdain for people that send HTML only email.  And surprisingly, this happens alot!  So, instead of trying to change the world, I&#8217;ve decided to just use mutt and lynx to my advantage and call it a day.  Thanks to one of my co-workers [...]]]></description>
			<content:encoded><![CDATA[<p>So, in my time with mutt, I have grown to have a disdain for people that send HTML only email.  And surprisingly, this happens alot!  So, instead of trying to change the world, I&#8217;ve decided to just use mutt and lynx to my advantage and call it a day.  Thanks to one of my co-workers for showing me how to do this.</p>
<p>At the end of your <em>~/.mailcap</em> file, add the following</p>
<blockquote><p>text/html; lynx -dump -width=78 -nolist %s | sed &#8217;s/^   //&#8217;; copiousoutput; needsterminal; nametemplate=%s.html</p></blockquote>
<p>Then, in the <em>~/.muttrc</em> add</p>
<blockquote><p>auto_view text/x-vcard text/html text/enriched</p></blockquote>
<p>And restart mutt.  This will use lynx to render the email.  You can substitute lynx for any text-based html browser you&#8217;d like.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/04/21/mutt-and-lynx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reverse Alias in mutt</title>
		<link>http://blog.deadlypenguin.com/blog/2009/02/23/reverse-alias-in-mutt/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/02/23/reverse-alias-in-mutt/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 20:57:40 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mutt]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=59</guid>
		<description><![CDATA[A need has arisen here recently for me to need to &#8220;change&#8221; the headers on an email, so I can tell two people at work apart.  Both have their name in the email header the same.  Let&#8217;s call them &#8220;John Doe.&#8221;  So in order to tell them apart, I&#8217;ve added a reverse alias rule to [...]]]></description>
			<content:encoded><![CDATA[<p>A need has arisen here recently for me to need to &#8220;change&#8221; the headers on an email, so I can tell two people at work apart.  Both have their name in the email header the same.  Let&#8217;s call them &#8220;John Doe.&#8221;  So in order to tell them apart, I&#8217;ve added a reverse alias rule to mutt to handle this.  First enable the use of them by using</p>
<blockquote><p>set reverse_alias</p></blockquote>
<p>Then set up the alias.  This can be added to your alias file, or straight into your <em>.muttrc</em></p>
<blockquote><p>alias fake_john john_doe2@example.com (Fake John Doe)</p></blockquote>
<p>Now all mail that comes in from <em>john_doe2@example.com</em> will show up as from &#8220;Fake John Doe&#8221; but the headers will remain the same, and no one is the wiser.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/02/23/reverse-alias-in-mutt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Apps to Desktop Apps</title>
		<link>http://blog.deadlypenguin.com/blog/2009/02/18/web-apps-to-desktop-apps/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/02/18/web-apps-to-desktop-apps/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 19:34:20 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=55</guid>
		<description><![CDATA[Something I&#8217;ve found very interesting, is the recent trend to move apps away from the desktop, and out into the &#8220;cloud.&#8221;  Now, for the most part I agree with this.  I rejoiced the day I moved from a pop3 account to an imap account.  And then rejoiced again, when I moved my [...]]]></description>
			<content:encoded><![CDATA[<p>Something I&#8217;ve found very interesting, is the recent trend to move apps away from the desktop, and out into the &#8220;cloud.&#8221;  Now, for the most part I agree with this.  I rejoiced the day I moved from a pop3 account to an imap account.  And then rejoiced again, when I moved my mail hosting to <a href="http://www.google.com/apps/">Google Apps</a>. This is just the way most things are moving.  Most people don&#8217;t need apps outside of email and word processing.  And if that information can be stored in the cloud then that means I don&#8217;t have to be without my documents.</p>
<p>That brings me to the real point.  If you haven&#8217;t gotten a chance to check out some of the apps that make desktop apps out of web apps, try them.</p>
<ul>
<li>I like <a href="http://fluidapp.com/">fluid</a> for OSX, it seems a little more full featured</li>
<li>Then <a href="http://labs.mozilla.com/projects/prism/">Prism</a> is looking really promising for all platforms (yes, even linux)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/02/18/web-apps-to-desktop-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perpetual Screen Part Deux</title>
		<link>http://blog.deadlypenguin.com/blog/2009/02/02/perpetual-screen-part-deux/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/02/02/perpetual-screen-part-deux/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 19:26:26 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=36</guid>
		<description><![CDATA[So, I&#8217;ve figured out how to add in a &#8220;fail-safe&#8221; to the perpetual screen, so that if you want to ssh without starting screen you can.  And it&#8217;s pretty easy.  First add the following to your sshd_config and restart ssh
AcceptEnv NO_SCREEN
Then add the following to the bottom of you .bashrc:   (Note: I named my screen [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve figured out how to add in a &#8220;fail-safe&#8221; to the perpetual screen, so that if you want to ssh without starting screen you can.  And it&#8217;s pretty easy.  First add the following to your sshd_config and restart ssh</p>
<blockquote><p>AcceptEnv NO_SCREEN</p></blockquote>
<p>Then add the following to the bottom of you .bashrc:   <em>(Note: I named my screen &#8216;main&#8217; you can name yours whatever you want)</em></p>
<blockquote><pre>NO_SCREEN=`echo "."$NO_SCREEN`
# Hack to get around if the variable is not set

if [ $TERM = "screen" ]
# If we are already in a screen do nothing
then
     echo -n ""
elif [ $TERM = "dumb" ]
# If we are using scp do nothing
then
     echo -n ""
elif [ $NO_SCREEN = ".true" ]
# Our fail safe to ssh w/o screen
then
     echo -n ""
else
# Startup screen
     screen -Rd main &amp;&amp; exit
fi</pre>
</blockquote>
<p>Then, you can either ssh like normal to start the screen, or do the following to login without screen starting</p>
<blockquote><p>export NO_SCREEN=&#8221;true&#8221;</p>
<p>ssh -o &#8220;SendEnv NO_SCREEN&#8221; user@host</p></blockquote>
<p>Works like a champ</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/02/02/perpetual-screen-part-deux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Combining pdf with linux via the command-line</title>
		<link>http://blog.deadlypenguin.com/blog/2009/01/06/combining-pdf-with-linux-via-the-command-line/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/01/06/combining-pdf-with-linux-via-the-command-line/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 18:56:45 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[pdf]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/?p=19</guid>
		<description><![CDATA[I&#8217;ve always found a need for this, and with some digging, I&#8217;ve found a couple of ways to do this.  The simplist is with ImageMagik, but I&#8217;ve found the default values leave the quality a little lacking.  However, I&#8217;ve found an article that uses GhostScript to do it, and it does a wonderful job.
gs -dBATCH [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always found a need for this, and with some digging, I&#8217;ve found a couple of ways to do this.  The simplist is with ImageMagik, but I&#8217;ve found the default values leave the quality a little lacking.  However, I&#8217;ve found <a href="http://www.brighthub.com/computing/linux/articles/14795.aspx" target="_blank">an article</a> that uses GhostScript to do it, and it does a wonderful job.</p>
<blockquote><p>gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf input1.pdf input2.pdf</p></blockquote>
<p>They suggest putting it in an alias, but I&#8217;ve gone a step further and just put it in a bash script in ~/bin/combinepdf</p>
<blockquote><pre>#!/bin/bash

if [ $# -le 1 ]
then
     echo "usage: combinepdf output.pdf input1.pdf ... inputN.pdf"
exit -1
fi

OUTPUT=$1

if [ -e $OUTPUT ]
then
     echo "Output file \"$OUTPUT\" exists"
exit -1
fi

fnum=2

INPUT="$2"
ARGV=( $@ )

while [ $fnum -lt $# ]
do
     INPUT=`echo $INPUT" "${ARGV[$fnum]}`
     let "fnum += 1"
done

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$OUTPUT $INPUT</pre>
</blockquote>
<p>Then <strong>chmod a+x ~/bin/combinepdf</strong> and then run it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/01/06/combining-pdf-with-linux-via-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
