<?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 etc. &#187; Bash shell</title>
	<atom:link href="http://promberger.info/linux/category/bash-shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://promberger.info/linux</link>
	<description>my outsourced memory for your perusal</description>
	<lastBuildDate>Mon, 02 Aug 2010 11:32:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mutt: set dynamic email signature from shell command output</title>
		<link>http://promberger.info/linux/2009/10/03/mutt-set-dynamic-email-signature-from-shell-command-output/</link>
		<comments>http://promberger.info/linux/2009/10/03/mutt-set-dynamic-email-signature-from-shell-command-output/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 09:29:48 +0000</pubDate>
		<dc:creator>Marianne</dc:creator>
				<category><![CDATA[Bash shell]]></category>
		<category><![CDATA[mutt]]></category>

		<guid isPermaLink="false">http://promberger.info/linux/?p=311</guid>
		<description><![CDATA[I want to set my signature when mailing to the r-help mailing list to contain information about the R version I have currently installed. Creating a bash script that directly echoes the several lines that I want to have in my signature and executing that in the muttrc using backticks gives a &#8220;broken pipe&#8221; error. [...]]]></description>
			<content:encoded><![CDATA[<p>I want to set my signature when mailing to the r-help mailing list to contain information about the <a href="http://www.r-project.org">R</a> version I have currently installed. Creating a bash script that directly echoes the several lines that I want to have in my signature and executing that in the muttrc using backticks gives a &#8220;broken pipe&#8221; error. </p>
<p>One solution (I&#8217;m sure there are others, maybe better ones) is to make the shell script create a temporary signature file and echo the path to that file, then execute the shell script using backticks.</p>
<p>Shell script (don&#8217;t forget to <code>chmod 744</code>):</p>
<pre>#!/bin/bash                                                                                          

thesigfile=~/.mutt/rsig

echo  "Marianne Promberger PhD, King's College London
http://promberger.info" > $thesigfile
R --version | head -n 1 >> $thesigfile
cat /etc/issue | head -n 1 | cut -d " " -f 1-2 >> $thesigfile
echo $thesigfile</pre>
<p><code>muttrc</code>:</p>
<pre>send-hook '~t r-help' 'set signature=`~/.mutt/signature_r-help`'</pre>
]]></content:encoded>
			<wfw:commentRss>http://promberger.info/linux/2009/10/03/mutt-set-dynamic-email-signature-from-shell-command-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use mutt to send individual e-mails to lots of people at once</title>
		<link>http://promberger.info/linux/2009/03/18/how-to-use-mutt-to-send-individual-e-mails-to-lots-of-people-at-once/</link>
		<comments>http://promberger.info/linux/2009/03/18/how-to-use-mutt-to-send-individual-e-mails-to-lots-of-people-at-once/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 18:15:30 +0000</pubDate>
		<dc:creator>Marianne</dc:creator>
				<category><![CDATA[Bash shell]]></category>
		<category><![CDATA[Noobs]]></category>
		<category><![CDATA[mutt]]></category>

		<guid isPermaLink="false">http://promberger.info/linux/?p=144</guid>
		<description><![CDATA[So, you want to send an e-mail to a list of people, but you don&#8217;t want to put them all in the &#8220;To:&#8221; or the &#8220;Bcc:&#8221; field of a single mail. You want each person to get an individual e-mail, but with the same subject line and the same content. It&#8217;s easy using mutt.

Create a [...]]]></description>
			<content:encoded><![CDATA[<p>So, you want to send an e-mail to a list of people, but you don&#8217;t want to put them all in the &#8220;To:&#8221; or the &#8220;Bcc:&#8221; field of a single mail. You want each person to get an individual e-mail, but with the same subject line and the same content. It&#8217;s easy using mutt.</p>
<ul>
<li>Create a text file that contains all the recipients, one on each line. This can be the full e-mail address, or it can be the alias you have defined in your mutt aliases file (which is your mutt &#8220;addressbook&#8221;). For our example, we&#8217;ll call it <code>recipients.txt</code></li>
<li>Create a text file with the text of your message. Let&#8217;s call it <code>message.txt</code>.</li>
<li>Create a bash shell script containing the following:
<pre>#!/bin/bash
while read line
do
mutt $line -s 'Message subject'  < message.txt
done < recipients.txt</pre>
<p>Where "Message subject" is whatever your message subject should be. Of course, you need to run your shell script from the directory in which the files "message.txt" and "recipients.txt" are stored. Otherwise, you need to substitute their names with the full path name, e.g. <code>~/message.txt</code>.
</li>
<li>Make your bash script executable and run it. Done. Your individual e-mails should show up in your mailfolder for sent mail (defined by <code>set record=...</code> in your <code>~/.muttrc</code>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://promberger.info/linux/2009/03/18/how-to-use-mutt-to-send-individual-e-mails-to-lots-of-people-at-once/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filename pattern matching via bash extended globbing and find regular expressions in shell scripts</title>
		<link>http://promberger.info/linux/2009/01/20/filename-pattern-matching-via-bash-extended-globbing-and-find-regular-expressions-in-shell-scripts/</link>
		<comments>http://promberger.info/linux/2009/01/20/filename-pattern-matching-via-bash-extended-globbing-and-find-regular-expressions-in-shell-scripts/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 12:59:21 +0000</pubDate>
		<dc:creator>Marianne</dc:creator>
				<category><![CDATA[Bash shell]]></category>
		<category><![CDATA[Regular expressions]]></category>

		<guid isPermaLink="false">http://promberger.info/linux/2009/01/20/filename-pattern-matching-via-bash-extended-globbing-and-find-regular-expressions-in-shell-scripts/</guid>
		<description><![CDATA[I was confused that bash would expand some patterns nicely to match filenames when I was on the commandline, but the same pattern would not work from inside a shell script. For example, the following pattern would nicely match all files in the current directory not having an &#8220;Rnw&#8221; or &#8220;tex&#8221; extension on the commandline:
ls [...]]]></description>
			<content:encoded><![CDATA[<p>I was confused that bash would expand some patterns nicely to match filenames when I was on the commandline, but the same pattern would not work from inside a shell script. For example, the following pattern would nicely match all files in the current directory not having an &#8220;Rnw&#8221; or &#8220;tex&#8221; extension on the commandline:</p>
<pre>ls *.!(Rnw|tex)</pre>
<p>Run from a shell script, however, this would give the error:</p>
<pre>line 5: syntax error near unexpected token `('</pre>
<p>It turns out on ubuntu, the shell option <code>extglob</code> is set for an interactive shell, but not for the non-interactive shell that is used when you run a script. You can see whether &#8220;extglob&#8221; is on like this, either from a commandline or by putting the line into your script:</p>
<pre>shopt extglob</pre>
<p> If it&#8217;s off and you want it on, put into your script:</p>
<pre>shopt -s extglob</pre>
<p>An alternative (that you might not want, I&#8217;m not sure what else it might affect) is to change the opening line of your script to read</p>
<pre>#!/bin/bash -i</pre>
<p>This runs your script in an interactive shell and should thus have the same behavior as the commandline. Generally, a neat trick is to use the <code>-x</code> option to debug shell scripts:</p>
<pre>#!/bin/bash -x</pre>
<p>An alternative way to get files whose names match a certain pattern is of course to use <code>find</code>. Here, you can either use limited globbing patterns with the <code>-name</code> option, and combine several patterns using <code>-o</code>, like this:</p>
<pre>find . -name "*.tex" -o -name "*.txt"</pre>
<p>Find also has a <code>-regex</code> option. If you use that, you probably want to use <code>-regex-type=posix-extended</code> to get a behavior that is more similar to extended regular expressions that you might know, for example from sed. Additionally, you have to watch out that <code>find</code> needs the regular expression to match the entire filename including the directory. Here is an example for this:</p>
<pre>audrey:~/tmp/testdir$ ls
blah.tex  blah.txt
audrey:~/tmp/testdir$ find . -regex "blah&#92;.tex"
audrey:~/tmp/testdir$ find . -regex "&#92;./blah&#92;.tex"
./blah.tex</pre>
<p>Here is an example for the difference between the default and the extended regex pattern behavior:</p>
<pre>audrey:~/tmp/testdir$ find . -regex "&#92;./blah&#92;.(tex|txt)"</pre>
<p>finds nothing, but:</p>
<pre>audrey:~/tmp/testdir$ find . -regextype posix-extended -regex "&#92;./blah&#92;.(tex|txt)"
./blah.tex
./blah.txt</pre>
<p>You could alternatively get the desired behavior with the default regex by escaping the grouping parentheses and the &#8220;|&#8221; operator:</p>
<pre>audrey:~/tmp/testdir$ find . -regex "&#92;./blah&#92;.&#92;(tex&#92;|txt&#92;)"
./blah.tex
./blah.txt</pre>
<p>But that starts getting really hard to read.</p>
]]></content:encoded>
			<wfw:commentRss>http://promberger.info/linux/2009/01/20/filename-pattern-matching-via-bash-extended-globbing-and-find-regular-expressions-in-shell-scripts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Removing duplicate lines from a file</title>
		<link>http://promberger.info/linux/2009/01/14/removing-duplicate-lines-from-a-file/</link>
		<comments>http://promberger.info/linux/2009/01/14/removing-duplicate-lines-from-a-file/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 17:54:57 +0000</pubDate>
		<dc:creator>Marianne</dc:creator>
				<category><![CDATA[Bash shell]]></category>
		<category><![CDATA[Code snippets]]></category>
		<category><![CDATA[awk]]></category>

		<guid isPermaLink="false">http://promberger.info/linux/2009/01/14/removing-duplicate-lines-from-a-file/</guid>
		<description><![CDATA[Case-insensitive:
{ rm "$file" &#038;&#038; awk '!x[tolower($1)]++' > "$file"; } < "$file"
Case-sensitive:
{ rm "$file" &#038;&#038; awk '!x[$1]++' > "$file"; } < "$file"
Here's a shell script you could use, as it stands, only works for one file at a time:

#!/bin/bash                  [...]]]></description>
			<content:encoded><![CDATA[<p>Case-insensitive:</p>
<pre>{ rm "$file" &#038;&#038; awk '!x[tolower($1)]++' > "$file"; } < "$file"</pre>
<p>Case-sensitive:</p>
<pre>{ rm "$file" &#038;&#038; awk '!x[$1]++' > "$file"; } < "$file"</pre>
<p>Here's a shell script you could use, as it stands, only works for one file at a time:</p>
<pre>
#!/bin/bash                                                                                  

usage()
{
cat << EOF                                                                                   

usage: $(basename $0) options filename                                                       

Removes duplicates from a file                                                               

OPTIONS:
   -h      Show this message
   -i      case insensitive
EOF
               }                                                                             

insensitive="no"                                                                             

while getopts "hi" option; do
    case $option in
        h)
            usage  ; exit 0
            ;;
        i)
            insensitive="yes"
            ;;
        "")
            usage ; exit 1
            ;;
        *)
            usage  ; exit 1
            ;;
    esac
done                                                                                         

shift $(($OPTIND - 1))                                                                       

filename="$1"                                                                                

if [ "$filename" == "" ] ; then
    usage ; exit 1
elif [ ! -f "$filename" ] ; then
    echo "File $filename does not exist" ; exit 1
fi                                                                                           

# make a backup
cp "$filename" "$filename"~                                                                  

if [ $insensitive == "yes" ] ; then
    { rm "$filename" &#038;&#038; awk '!x[tolower($1)]++' > "$filename"; } < "$filename"
else
    { rm "$filename" &#038;&#038; awk '!x[$1]++' > "$filename"; } < "$filename"
fi
</pre>
<p>Here's some nice concise <a href="http://www.linux.com/feature/118031">information about getopts and shift</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://promberger.info/linux/2009/01/14/removing-duplicate-lines-from-a-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SD card with ReiserFS for backups</title>
		<link>http://promberger.info/linux/2008/05/15/sd-card-with-reiserfs-for-backups/</link>
		<comments>http://promberger.info/linux/2008/05/15/sd-card-with-reiserfs-for-backups/#comments</comments>
		<pubDate>Thu, 15 May 2008 21:45:24 +0000</pubDate>
		<dc:creator>Marianne</dc:creator>
				<category><![CDATA[Bash shell]]></category>
		<category><![CDATA[Gutsy]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://promberger.info/linux/2008/05/15/sd-card-with-reiserfs-for-backups/</guid>
		<description><![CDATA[The hard drive on my laptop has occasionally been making some funny  klicking noises recently, and I&#8217;m a bit worried it&#8217;s going to break down one of these days. So in addition to backups to an external HD and a USB stick, I bought a 4 GB SD card to just leave in the [...]]]></description>
			<content:encoded><![CDATA[<p>The hard drive on my laptop has occasionally been making some funny  klicking noises recently, and I&#8217;m a bit worried it&#8217;s going to break down one of these days. So in addition to backups to an external HD and a USB stick, I bought a 4 GB SD card to just leave in the card reader.</p>
<p>I formatted this with gparted, first to ext3, then to ext2 (I wanted something that would preserve permissions), but after backup up some files to it (using <a href="http://samba.anu.edu.au/rsync">rsync</a> and <a href="http://www.nongnu.org/rdiff-backup/">rdiff-backup</a>)  I ended up with lots of input/output errors and bad superblocks and whatnot. </p>
<p>I then used gparted to make it ReiserFS, and that worked. One other thing that I did differently was that after formatting the SD card to ReiserFS, I removed the card, then shut down the machine and rebooted before reinserting the card and actually putting any data on it. I hadn&#8217;t done this for the ext* FS, no clue if it could have made a difference. </p>
<p>The filesystem works nicely and it seems quite a bit faster than both ext3 and ext2 (I have mostly small text files, and a few pdfs). </p>
<p>However, letting the card be automounted (by HAL, I assume?) resulted in occasional total freezes when mounting/ unmounting.</p>
<p>So I put a line into <code>/etc/fstab</code></p>
<pre>/dev/mmcblk0p1  /media/kate                 auto    auto,user,rw,exec 0 0</pre>
<p>and now I can just leave the card in.</p>
<p>However, the laptop then failed to suspend and resume properly. That was solved by putting a script each into <code>/etc/acpi/suspend.d</code> and <code>resume.d</code> to unmount and remount the card:</p>
<pre>
audrey:~$ cat /etc/acpi/suspend.d/01-umount-kate.sh
#!/bin/sh

/bin/umount /media/kate
</pre>
<p>and &#8230;</p>
<pre>audrey:~$ cat /etc/acpi/resume.d/91-mount-kate.sh
#!/bin/sh

/bin/mount /media/kate &#038;&#038; /bin/chown mpromber:mpromber /media/kate</pre>
]]></content:encoded>
			<wfw:commentRss>http://promberger.info/linux/2008/05/15/sd-card-with-reiserfs-for-backups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does the Pembury Tavern have Augustiner Helles?</title>
		<link>http://promberger.info/linux/2008/04/29/does-the-pembury-tavern-have-augustiner-helles/</link>
		<comments>http://promberger.info/linux/2008/04/29/does-the-pembury-tavern-have-augustiner-helles/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 22:04:22 +0000</pubDate>
		<dc:creator>Marianne</dc:creator>
				<category><![CDATA[Bash shell]]></category>
		<category><![CDATA[Cool stuff]]></category>
		<category><![CDATA[procmail]]></category>

		<guid isPermaLink="false">http://promberger.info/linux/2008/04/29/does-the-pembury-tavern-have-augustiner-helles/</guid>
		<description><![CDATA[We are lucky to have the Pembury Tavern around the corner, a nice pub whose  beer selection includes our favorite beer from Munich, Augustiner Helles. The only problem: The Pembury&#8217;s wholesale supplier sometimes has problems with stocking enough Augustiner, and that along with the fact that Augustiner, containing no additives, doesn&#8217;t keep longer than [...]]]></description>
			<content:encoded><![CDATA[<p>We are lucky to have the <a href="http://www.individualpubs.co.uk/pembury">Pembury Tavern</a> around the corner, a nice pub whose  <a href="http://www.individualpubs.co.uk/pembury/drinks.html">beer selection</a> includes our favorite beer from Munich, <a href="http://www.augustiner-braeu.de/">Augustiner</a> Helles. The only problem: The Pembury&#8217;s wholesale supplier sometimes has problems with stocking enough Augustiner, and that along with the fact that Augustiner, containing no additives, doesn&#8217;t keep longer than about two months, makes for the all-too-frequent Augustiner shortage at the Pembury. </p>
<p>Nicola and I have been joking for some time that there should be a shell script to check whether the Pembury currently offers Augustiner. Well, it turns out this is easily possible, since the Pembury is in fact a Linux-powered pub whose website directly and accurately reflects what&#8217;s in the cellar. Enter lynx-dump and we&#8217;re all set: </p>
<pre>
#!/bin/bash
WEBSITE=http://www.individualpubs.co.uk/pembury/drinks.html
AUGUSTINER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i augustiner)
JEVER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i jever)
ANDECHS=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i andechs)
if [ -n  "$AUGUSTINER" ]; then
         echo "The PT currently serve:
$AUGUSTINER
$JEVER
$ANDECHS"
elif    [ -n "$JEVER" -o  -n "$ANDECHS" ]; then
         echo "The PT currently serve no Augustiner, but they serve:
$JEVER
$ANDECHS"
else
     echo "Sorry, the PT currently serve neither Augustiner, nor Jever, nor Andechser."
fi
</pre>
<p>As you&#8217;ll notice, this also checks for Andechser or Jever as alternative solutions to our cravings for German beer. :)</p>
<p>For even more geeky fun, I&#8217;ve put up a mail reply service. If you send an e-mail with the subject line &#8220;PT-augustiner-info&#8221; to my private e-mail address (my first name (at) my last name (dot) info), you should receive a reply containing the up-to-date information. </p>
<p>This service uses <code>procmail</code> and anohter shell script. </p>
<p>The shell script:</p>
<pre>
#!/bin/bash
SENDER=$(formail -x "From:")
WEBSITE=http://www.individualpubs.co.uk/pembury/drinks.html
AUGUSTINER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i augustiner)
JEVER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i jever)
ANDECHS=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i andechs)
if [ -n  "$AUGUSTINER" ]; then
      echo "The PT currently serve
$AUGUSTINER
$JEVER
$ANDECHS" | mail "$SENDER" -s "The PT serve Augustiner"
elif    [ -n "$JEVER" -o  -n "$ANDECHS" ]; then
      echo "The PT currently serve no Augustiner, but they serve:
$JEVER
$ANDECHS" | mail "$SENDER" -s "The PT currently serve no Augustiner, but ..."
else
      echo "Sorry, the PT serve neither Augustiner, nor Andechser, nor Jever
But you might check out $WEBSITE for other nice beers." | mail "$SENDER" -s "Sorry, no Augustiner, Jever, or Andechser beer at the PT"
fi
</pre>
<p>The recipe in <code>~/.procmailrc</code>:</p>
<pre>
:0
* ^Subject.*PT-augustiner-info$
| /home/mpromber/bin/augustiner
</pre>
<h3>Addendum</h3>
<p>The e-mail information service now also works if you send an e-mail to <tt>augustiner</tt> (at) mylastname (dot) info. If you&#8217;re unsure what my last name is, look at the URL of this blog :) The modified procmail recipe for this (since one can never have too many examples of procmail recipes):</p>
<pre>:0
* (^Subject.*PT-augustiner-info$)|(^To.*augustiner@promberger.info$)
| /home/mpromber/bin/augustiner</pre>
]]></content:encoded>
			<wfw:commentRss>http://promberger.info/linux/2008/04/29/does-the-pembury-tavern-have-augustiner-helles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell script to periodically check mail logs (and msmtpQ queue) and notify user by mail</title>
		<link>http://promberger.info/linux/2008/04/13/shell-script-to-check-mail-logs-periodically/</link>
		<comments>http://promberger.info/linux/2008/04/13/shell-script-to-check-mail-logs-periodically/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 17:47:23 +0000</pubDate>
		<dc:creator>Marianne</dc:creator>
				<category><![CDATA[Bash shell]]></category>
		<category><![CDATA[Noobs]]></category>
		<category><![CDATA[Sed]]></category>
		<category><![CDATA[mutt]]></category>

		<guid isPermaLink="false">http://promberger.info/linux/2008/04/13/shell-script-to-check-mail-logs-periodically/</guid>
		<description><![CDATA[As said in this previous post, I generally really like the speed of having
set sendmail_wait = -1
in my ~/.muttrc, but mutt doesn&#8217;t let me know if there are any error messages. That&#8217;s not good, and it would be ironic to gain a few seconds when hitting y in mutt just to nervously dig around in [...]]]></description>
			<content:encoded><![CDATA[<p>As said in <a href="http://promberger.info/linux/2008/04/11/mutt-with-msmtp-and-a-mail-queue/">this previous post</a>, I generally really like the speed of having</p>
<pre>set sendmail_wait = -1</pre>
<p>in my <code>~/.muttrc</code>, but mutt doesn&#8217;t let me know if there are any error messages. That&#8217;s not good, and it would be ironic to gain a few seconds when hitting <code>y</code> in mutt just to nervously dig around in error logs all the time. In addition, while I like my new mail queue setup for the laptop,I find that, too, a bit too silent: the mail gets queued without any notification whenever I&#8217;m offline, and queued mail doesn&#8217;t get sent automatically when I&#8217;m back online (I actually prefer that &#8212; better that than inadvertently sending off mails that I was planning to delete from the queue). </p>
<p>So I wrote a shell script that checks both for errors and for queued mail and notifies me via the local exim4 MTA with messages that go into /var/mail/username. I&#8217;ve put that shell script online: <a href="http://promberger.info/files/checklog">checklog</a>.  This is all pretty basic stuff, but it might come in handy for someone, or if you&#8217;re new to shell scripting, you can never have too many examples.</p>
<p>I&#8217;ve put it into my <code>~/bin</code>, made it executable, and call it every two hours and at reboot from <code>~/.crontab</code>.</p>
<pre>0 */2 * * *  /home/mpromber/bin/checklog
@reboot      /home/mpromber/bin/checklog</pre>
<p>To make it take effect:</p>
<pre>crontab ~/.crontab</pre>
<p>On the laptop, I&#8217;ve also put a symbolic link to that script into   <code>/etc/acpi/resume.d</code> so it gets executed on waking up from suspend, because that&#8217;s likely to have a correlation with wanting to be reminded of queued mail:</p>
<pre>sudo ln -s /home/mpromber/bin/checklog /etc/acpi/resume.d/99-checklog.sh</pre>
<p>Note that I had to give the symlink a name ending in &#8220;.sh&#8221;, since <code>/etc/acpi/resume.sh</code> above that directory only calls scripts with that pattern:</p>
<pre>#!/bin/bash

# Source from /etc/acpi/resume.d/
for SCRIPT in /etc/acpi/resume.d/*.sh; do
    if [ -x $SCRIPT ]; then
        . $SCRIPT
    fi
done</pre>
]]></content:encoded>
			<wfw:commentRss>http://promberger.info/linux/2008/04/13/shell-script-to-check-mail-logs-periodically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
