<?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>Kristijan.org</title>
	<atom:link href="http://www.kristijan.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kristijan.org</link>
	<description>it's a nerd thing</description>
	<lastBuildDate>Wed, 30 Sep 2009 01:59:57 +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>TSM: Lost Tapes</title>
		<link>http://www.kristijan.org/2009/09/tsm-lost-tapes/</link>
		<comments>http://www.kristijan.org/2009/09/tsm-lost-tapes/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 01:58:16 +0000</pubDate>
		<dc:creator>Kristijan</dc:creator>
				<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[aix]]></category>
		<category><![CDATA[drm]]></category>
		<category><![CDATA[drmedia]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[tsm]]></category>

		<guid isPermaLink="false">http://www.kristijan.org/?p=112</guid>
		<description><![CDATA[We had an issue not long ago were Tivoli Storage Manager was losing track of tapes. The issue ended up being how TSM manages database snapshots which are sent offsite using DRM (Bug in TSM which has been around for a while according to a colleague of mine).
I needed to find out quickly which tapes [...]]]></description>
			<content:encoded><![CDATA[<p>We had an issue not long ago were Tivoli Storage Manager was losing track of tapes. The issue ended up being how TSM manages database snapshots which are sent offsite using DRM (Bug in TSM which has been around for a while according to a colleague of mine).</p>
<p>I needed to find out quickly which tapes TSM had no knowledge of, and had essentially become scratch. I wrote the following script to do just that for me. You&#8217;ll need to tailor it to your environment, as our tapes are bar-coded COL000L4 through to COL120L4.<br />
<span id="more-112"></span></p>
<pre name="code" class="bash:nocontrols">
#!/usr/bin/ksh

dsmadmc="/usr/bin/dsmadmc -id=username -pass=password -dataonly=yes -displ=lis"
count=0
zero=00

echo "The following tapes do not exist in TSM:"
while (( $count <= 120 )); do
        if [ $count -gt 9 ]; then
        let zero=0
        fi

        if [ $count -gt 99 ]; then
        unset zero
        fi

        $dsmadmc q volume ???${zero}${count}?? > /dev/null 2>&#038;1
        if [ $? -ne 0 ]; then
        echo COL${zero}${count}L4
        fi

        let count="count + 1"

done
exit
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kristijan.org/2009/09/tsm-lost-tapes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitor AIX filesystems V2</title>
		<link>http://www.kristijan.org/2009/09/monitor-aix-filesystems-v2/</link>
		<comments>http://www.kristijan.org/2009/09/monitor-aix-filesystems-v2/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 01:34:46 +0000</pubDate>
		<dc:creator>Kristijan</dc:creator>
				<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[aix]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://www.kristijan.org/?p=109</guid>
		<description><![CDATA[I updated this script a while back and made it a lot easier to maintain. It now checks for usage on all mounted filesystems, except for those listed in the $SKIPFS variable.


#!/usr/bin/ksh
#
# This script reports filesystem usages for
# all mounted filesystems.
#
# Filesystems can be excluded by editing the
# SKIPFS variable e.g. SKIPFS='/proc&#124;/test&#124;/home'

MAIL=/usr/bin/mail
RCPT='your@email.com'
USAGE=80
HOSTNAME=`hostname`
SKIPFS='/proc&#124;/test'

set -A fs `df [...]]]></description>
			<content:encoded><![CDATA[<p>I updated this script a while back and made it a lot easier to maintain. It now checks for usage on all mounted filesystems, except for those listed in the $SKIPFS variable.<br />
<span id="more-109"></span></p>
<pre name="code" class="bash:nocontrols">
#!/usr/bin/ksh
#
# This script reports filesystem usages for
# all mounted filesystems.
#
# Filesystems can be excluded by editing the
# SKIPFS variable e.g. SKIPFS='/proc|/test|/home'

MAIL=/usr/bin/mail
RCPT='your@email.com'
USAGE=80
HOSTNAME=`hostname`
SKIPFS='/proc|/test'

set -A fs `df -k | grep -vE $SKIPFS | awk '{ print $4 }' | awk 'NR!=1' | sed 's/%//'`
set -A fn `df -k | grep -vE $SKIPFS | awk '{ print $7 }' | awk 'NR!=1'`

count=0
while (( $count < ${#fs[*]} )); do
        fssize=${fs[$count]}
        if
                [ $fssize -ge $USAGE ]; then
                echo "${fn[$count]} on $HOSTNAME is at ${fssize}%" | $MAIL -s "WARNING on $HOSTNAME" $RCPT
        fi
        let count="count + 1"
done

exit
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kristijan.org/2009/09/monitor-aix-filesystems-v2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitor AIX filesystems</title>
		<link>http://www.kristijan.org/2009/02/monitor-aix-filesystems/</link>
		<comments>http://www.kristijan.org/2009/02/monitor-aix-filesystems/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 03:49:00 +0000</pubDate>
		<dc:creator>Kristijan</dc:creator>
				<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[aix]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.kristijan.org/?p=104</guid>
		<description><![CDATA[If you&#8217;re looking for something cheap and nasty to monitor your filesystem usage while you&#8217;re setting up something more robust, here is a cheap and very nasty script to do just that.


#!/usr/bin/ksh
# This script monitors various filesystems and emails
# notifications when they hit a set limit
#
MAILTO='your@email.com'
HOSTNAME=`hostname`

ROOT=`df -k&#124;grep "/dev/hd4"&#124;awk '{print $4}'&#124;sed "s/%//"`
USR=`df -k&#124;grep "/dev/hd2"&#124;awk '{print $4}'&#124;sed [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re looking for something cheap and nasty to monitor your filesystem usage while you&#8217;re setting up something more robust, here is a cheap and very nasty script to do just that.<br />
<span id="more-104"></span></p>
<pre name="code" class="bash:nocontrols">
#!/usr/bin/ksh
# This script monitors various filesystems and emails
# notifications when they hit a set limit
#
MAILTO='your@email.com'
HOSTNAME=`hostname`

ROOT=`df -k|grep "/dev/hd4"|awk '{print $4}'|sed "s/%//"`
USR=`df -k|grep "/dev/hd2"|awk '{print $4}'|sed "s/%//"`
VAR=`df -k|grep "/dev/hd9var"|awk '{print $4}'|sed "s/%//"`
HOME=`df -k|grep "/dev/hd1"|grep -v opt|awk '{print $4}'|sed "s/%//"`
OPT=`df -k|grep "/opt"|awk '{print $4}'|sed "s/%//"`
TMP=`df -k|grep "/dev/hd3"|awk '{print $4}'|sed "s/%//"`

if [ $ROOT -gt 79 ]
then
   echo "We have hit ${ROOT}% on / on $HOSTNAME"|mailx -s "WARNING on $HOSTNAME" $MAILTO
fi
if [ $USR -gt 79 ]
then
   echo "We have hit ${USR}% on /usr on $HOSTNAME"|mailx -s "WARNING on $HOSTNAME" $MAILTO
fi
if [ $VAR -gt 79 ]
then
   echo "We have hit ${VAR}% on /var on $HOSTNAME"|mailx -s "WARNING on $HOSTNAME" $MAILTO
fi
if [ $HOME -gt 79 ]
then
   echo "We have hit ${HOME}% on /home on $HOSTNAME"|mailx -s "WARNING on $HOSTNAME" $MAILTO
fi
if [ $OPT -gt 79 ]
then
   echo "We have hit ${OPT}% on /opt on $HOSTNAME"|mailx -s "WARNING on $HOSTNAME" $MAILTO
fi
if [ $TMP -gt 79 ]
then
   echo "We have hit ${TMP}% on /tmp on $HOSTNAME"|mailx -s "WARNING on $HOSTNAME" $MAILTO
fi

exit
</pre>
<p>The above script is running on an AIX operating environment, so you&#8217;ll need to modify the variables to suit. It&#8217;s not all that far to figure out, but if you need a hand&#8230;shout out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kristijan.org/2009/02/monitor-aix-filesystems/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Split and Reassemble files</title>
		<link>http://www.kristijan.org/2008/12/split-and-reassemble-files/</link>
		<comments>http://www.kristijan.org/2008/12/split-and-reassemble-files/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 00:20:39 +0000</pubDate>
		<dc:creator>Kristijan</dc:creator>
				<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bash scripting]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[reassemble]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[split]]></category>

		<guid isPermaLink="false">http://www.kristijan.org/?p=86</guid>
		<description><![CDATA[I wrote this a few years back for LinuxQuestions.org. It was around 2004 from memory, and majority of the mail servers in Internet land only allowed for 2MB file attachments. This has now change, but I thought I&#8217;d post the article anyway.
There always comes a time, where you wish that file was only a few [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote this a few years back for LinuxQuestions.org. It was around 2004 from memory, and majority of the mail servers in Internet land only allowed for 2MB file attachments. This has now change, but I thought I&#8217;d post the article anyway.</p>
<p>There always comes a time, where you wish that file was only a few kilobytes/megabytes smaller. Whether it be so it can fit onto your floppy disk, CD-R etc, or so you can meet the attachment limit on an e-mail server. This isn&#8217;t really a command that you would use everyday, but it might come in handy.</p>
<p><strong><u>Splitting the file</u></strong></p>
<pre name="code" class="html:nocontrols:nogutter">
kristijan@slackware testing$ ls -lh
total 13M
-rw-rw-r--  1 kristijan users 13M Jul 23 18:18 karaoke.mp3
</pre>
<p>Just say we wanted to e-mail this file to a friend, but the e-mail server only allowed a maximum of 2MB attachments.</p>
<p>(Note** I like to play safe, so I will make my chunks of data 1.9M)</p>
<p>1.9 x 1024 = 1945.6</p>
<p>(Note** To play safe once again, I will leave out the decimal and just use 1945)</p>
<p>The command that we will use is:
<pre name="code" class="html:nocontrols:nogutter">
kristijan@slackware testing$ split -b 1945k karaoke.mp3</pre>
<pre name="code" class="html:nocontrols:nogutter">
kristijan@slackware testing$ split -b 1945k karaoke.mp3
kristijan@slackware testing$ ls -lh
total 26M
-rw-rw-r--  1 kristijan users  13M Jul 23 18:18 karaoke.mp3
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xaa
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xab
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xac
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xad
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xae
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xaf
-rw-rw-r--  1 kristijan users 1.4M Jul 23 18:22 xag
</pre>
<p>OK, what we have now done is told &#8217;split&#8217; to use bytes per output file (-b). For more information and arguments on split, view the man pages (man split). Split how now &#8217;split&#8217; karaoke.mp3 into 7 smaller files named &#8216;xaa&#8217;, &#8216;xab&#8217;, &#8216;xac&#8217; etc, which are all under 2M in size.</p>
<p>These files now meet the e-mail server&#8217;s attachment limit and can be sent.</p>
<p><strong><u>Recreating the file (cat)</u></strong></p>
<p>Recreation of the karaoke.mp3 is even easier. For this, we will be using &#8216;cat&#8217;. See the man pages for more information on &#8216;cat&#8217; (man cat).</p>
<p>The command that we will use is:</p>
<pre name="code" class="html:nocontrols:nogutter">kristijan@slackware testing$ cat xa* > karaoke-restored.mp3
</pre>
<p>(Note** Before removing the original file, I recommend that you make a backup of it)</p>
<pre name="code" class="html:nocontrols:nogutter">
kristijan@slackware testing$ rm karaoke.mp3
kristijan@slackware testing$ ls -lh
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xaa
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xab
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xac
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xad
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xae
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xaf
-rw-rw-r--  1 kristijan users 1.4M Jul 23 18:22 xag
kristijan@slackware testing$ cat xa* > karaoke-restored.mp3
kristijan@slackware testing$ ls -lh
total 26M
-rw-rw-r--  1 kristijan users  13M Jul 23 18:39 karaoke-restored.mp3
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xaa
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xab
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xac
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xad
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xae
-rw-rw-r--  1 kristijan users 1.9M Jul 23 18:22 xaf
-rw-rw-r--  1 kristijan users 1.4M Jul 23 18:22 xag
</pre>
<p>By using cat, we have now recreated the original file. The &#8216;xaa&#8217;, xab&#8217; etc files may now be deleted.</p>
<p>There we have it, the karaoke file is now restored and can be played as per normal.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kristijan.org/2008/12/split-and-reassemble-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I&#8217;m back!</title>
		<link>http://www.kristijan.org/2008/12/im-back/</link>
		<comments>http://www.kristijan.org/2008/12/im-back/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 11:21:58 +0000</pubDate>
		<dc:creator>Kristijan</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Rambling]]></category>

		<guid isPermaLink="false">http://www.kristijan.org/?p=77</guid>
		<description><![CDATA[How could I stay away? From the shear number of e-mails flooding my inbox daily for updates to my infamous blog, I couldn&#8217;t keep the fans in the dark no more!
*cough*
Back to reality&#8230;I&#8217;m not reviving my old blog, but starting a new one. I&#8217;ve been working as a systems administrator for about 4 years now, [...]]]></description>
			<content:encoded><![CDATA[<p>How could I stay away? From the shear number of e-mails flooding my inbox daily for updates to my infamous blog, I couldn&#8217;t keep the fans in the dark no more!</p>
<p>*cough*</p>
<p>Back to reality&#8230;I&#8217;m not reviving my old blog, but starting a new one. I&#8217;ve been working as a systems administrator for about 4 years now, got a nice collection of helpful scripts and what not that I&#8217;d like to share to hopefully make your job easier.</p>
<p>This blog probably won&#8217;t be updated daily, or weekly. To be honest, you&#8217;ll be lucky to see activity on here once a month. Regardless, if you like something you see, make a comment and let me know.</p>
<p>Enjoy <img src='http://www.kristijan.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.kristijan.org/2008/12/im-back/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sending files to multiple Windows hosts</title>
		<link>http://www.kristijan.org/2008/12/sending-files-to-multiple-windows-hosts/</link>
		<comments>http://www.kristijan.org/2008/12/sending-files-to-multiple-windows-hosts/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 10:22:07 +0000</pubDate>
		<dc:creator>Kristijan</dc:creator>
				<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bash scripting]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows xp]]></category>

		<guid isPermaLink="false">http://www.kristijan.org/?p=71</guid>
		<description><![CDATA[A few months ago at work, I needed to send a number of files to a little over 100 Windows workstations. I had administrator rights on all these workstations, and luckily for me, they all had the same administrator password.
I had access to a Red Hat AS4 server, so I wrote a shell script to [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago at work, I needed to send a number of files to a little over 100 Windows workstations. I had administrator rights on all these workstations, and luckily for me, they all had the same administrator password.</p>
<p>I had access to a Red Hat AS4 server, so I wrote a shell script to read all the hostnames of the workstations from a text file, mount each C$ share via CIFS, copy the necessary files, unmount and repeat.</p>
<p>Over the past few weeks, I added a few other things which I were of use (ping check prior to send, file verification on remote workstation).</p>
<pre name="code" class="bash:nocontrols">
#!/bin/bash
#
# Script to send files to Windows workstations

# set -x

function runPingCheck ()
{
	grep -vE '^$|^#' callcentres/$name.txt | while read i
        do ping -c 1 `echo $i | awk '{print $1}'`.fqdn.com &#038;> /dev/null
                if [ $? -gt 0 ]; then
                        echo -e "$i ... PING FAIL"
                fi

        done
	echo ""
	echo "Check complete"
	echo ""
	echo -n "Continue with send(Y/N) [Y]? "
	read contsend
		case "$contsend" in
			N|n) exit 1 ;;
			Y|y|*) runSendFiles ;;
		esac
}

function runSendFiles ()
{
	echo "Send started `date`" | tee -a $name.log

	grep -vE '^$|^#' callcentres/$name.txt | while read i
        do ping -c 1 `echo $i | awk '{print $1}'`.fqdn.com &#038;> /dev/null
                if [ $? -gt 0 ]; then
                        echo "$i ... Host Offline" | tee -a $name.log
                        continue
                fi

                mount -t cifs //`echo $i | awk '{print $1}'`.fqdn.com/c$ /mnt/winmnt -o user=administrator,pass=PASSHERE
                if [ $? -gt 0 ]; then
                        echo "$i ... Failed CIFS Mount" | tee -a $name.log
                else
                        cp -R ./files/* /mnt/winmnt
                                if [ -e /mnt/winmnt/sent.tmp ]; then
                                        rm /mnt/winmnt/sent.tmp
                                        umount /mnt/winmnt
                                        echo "$i ... Complete" | tee -a $name.log
                                else
                                        umount /mnt/winmnt
                                        echo "$i ... Failed File Verification" | tee -a $name.log
                                fi
                fi
        done

	echo "Send completed `date`" | tee -a $name.log
}

ls ./callcentres | sed 's/.txt//g'
echo ""
echo -n "Type the name of the call centre you wish to upgrade: "
read name

echo ""
echo -n "Would you like to run a ping check before you send(Y/N) [Y]? "
read pingcheck

case "$pingcheck" in
	N|n) runSendFiles ;;
	Y|y|*) runPingCheck ;;
esac

exit 0
</pre>
<p>The basic directory structure looks like this:<br />
/callcentres<br />
     &#8211; melbourne.txt<br />
/files<br />
/sendscript.sh</p>
<p>melbourne.txt just had a list of all the hostnames, each on its own line. (# can be used at the start of any line to skip a particular workstation).</p>
<pre name="code" class="bash:nocontrols">
host1
#host2
host3
...
host100
</pre>
<p>/files contains any file that you want to send to the remote Windows host. Take note that you need to provide the absolute path of the Windows location (e.g. /files/Program Files/)</p>
<p>Output of the script will be logged to STDOUT and to a log file in the root directory where sendscript.sh resides.</p>
<p>Once you have the file structure and sendscript.sh in order, simply run the script. You will be prompted for the name of the &#8220;call centre&#8221; you wish to send files to. In this example, you would enter <strong>melbourne</strong>. Then you will be asked if you&#8217;d like to run a ping check on each workstation prior to the file send.</p>
<p>Happy sending <img src='http://www.kristijan.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.kristijan.org/2008/12/sending-files-to-multiple-windows-hosts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Unrar TV show packs</title>
		<link>http://www.kristijan.org/2008/12/unrar-tv-show-packs/</link>
		<comments>http://www.kristijan.org/2008/12/unrar-tv-show-packs/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 09:49:15 +0000</pubDate>
		<dc:creator>Kristijan</dc:creator>
				<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bash scripting]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[the big bang theory]]></category>

		<guid isPermaLink="false">http://www.kristijan.org/?p=62</guid>
		<description><![CDATA[We all download TV shows, there is no use denying it. I recently got pointed in the directory of a rather funny show called The Big Bang Theory. I grabbed the first episode of season 1, saw what I liked, then grabbed the entire season 1 pack.
17 episodes, each in their own folder in .rar [...]]]></description>
			<content:encoded><![CDATA[<p>We all download TV shows, there is no use denying it. I recently got pointed in the directory of a rather funny show called The Big Bang Theory. I grabbed the first episode of season 1, saw what I liked, then grabbed the entire season 1 pack.</p>
<p>17 episodes, each in their own folder in .rar files.<br />
What a pain in the ass!</p>
<p>Instead of clicking away at each RAR file individually, I put together a little bash script to do the work for me which I&#8217;ve called <strong>unrar_all</strong>.</p>
<pre name="code" class="bash:nocontrols">
#!/bin/bash
#
# Script to unrar season packs of TV shows
# Put it in the directory containing all the directorys
#
# eg.
#       Big_Bang_Theory.1x01.Pilot.DVDRip_XviD-FoV/
#       Big_Bang_Theory.1x02.The_Big_Bran_Hypothesis.DVDRip_XviD-FoV/
#       Big_Bang_Theory.1x03.The_Fuzzy_Boots_Corollary.DVDRip_XviD-FoV/
#       unrar_all

find . -type d -print | while read i
        do pushd .
        cd $i
                unset partrar
                partrar=`find . -name *part01.rar`
                if [ -n "$partrar" ]; then
                unrar e *part01.rar
                mv *.avi ../
                popd
        else
                unrar e *.rar
                mv *.avi ../
                popd
        fi
done
</pre>
<p>This script requires <a href="http://www.rarlab.com/rar_add.htm">unrar</a> from RARLabs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kristijan.org/2008/12/unrar-tv-show-packs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
