&lt;?xml version="1.0" encoding="utf-8"?>
        <sphinx:docset>
            <sphinx:schema>
              <sphinx:field name="title"/>
              <sphinx:attr name="title" type="string"/>
              <sphinx:attr name="link" type="string"/>
              <sphinx:field name="content"/>
              <sphinx:attr name="content" type="string"/>
              <sphinx:attr name="pubDate" type="timestamp"/>
              
            </sphinx:schema>
            
            <sphinx:document id="1080 ">
              <title>&lt;![CDATA[Raspberry Pi automate certain tasks  – script example]]></title>
              <link>&lt;![CDATA[/2014/03/10/raspberry-pi-automate-tasks-script/]]></link>
              <pubDate>1394415705</pubDate>
              <content>&lt;![CDATA[Now, if you have followed these :
fetchmail
ssmtp
Then you already have a working system for sending and receiving mail. Now, you can set the mda in the fetmailrc to a script which can do few things for you. The script below will get a page and mail it to you, if you have the subject as “get” and send “wake on LAN” to desired PC if you have subject as “wol”. Cool 🙂
Original idea from here.
Here is the script:
#!/bin/bashexpectedFrom=&#34;&#34;expectedFrom2=&#34;&#34;homePC=&#34;MAC Here&#34;mailHelp() {sendMail $1 &#34;Help - Possible Commands&#34; &#34;Help&#34;}sendMail() {echo &#34;To: &#34;$1 &amp;gt; $tmpMailecho &#34;From: From address here&#34; &amp;gt;&amp;gt; $tmpMailecho &#34;Subject: &#34;$2 &amp;gt;&amp;gt; $tmpMailecho &#34;Content-Type: text/html&#34; &amp;gt;&amp;gt; $tmpMailecho &#34;&#34; &amp;gt;&amp;gt; $tmpMailecho $3 &amp;gt;&amp;gt; $tmpMailcat $tempMail &amp;gt;&amp;gt; $tmpMailcat $tmpMail|/usr/sbin/ssmtp $1}#here we start the actual processingrightSender=0sender=&#34;&#34;tmpFile=/tmp/mailtemptmpMail=&#34;/var/tmp/mailtxt.txt&#34;tempMail=&#34;/tmp/tosend.txt&#34;&amp;gt;$tempMail&amp;gt;$tmpFile&amp;gt;$tmpMail#Write the mail to tmpFilewhile read linedoecho $line &amp;gt;&amp;gt; $tmpFiledonegrep &#34;From:&#34; $tmpFile | grep $expectedFrom &amp;gt; /dev/nullif [ $? -eq 0 ]; thenrightSender=1sender=$expectedFromfigrep &#34;From:&#34; $tmpFile | grep $expectedFrom2 &amp;gt; /dev/nullif [ $? -eq 0 ]; thenrightSender=1sender=$expectedFrom2fiif [ $rightSender -eq 1 ]; thentask=`grep &#34;Subject:&#34; $tmpFile`task=${task:9}task=`echo $task | tr [:upper:] [:lower:]`echo $task | grep &#34;help&#34; &amp;gt; /dev/nullif [ $? -eq 0 ]; thenmailHelp $senderexitfifiwhile read linedoif [[ $line =~ ^$|^Content*:*|^charset=*|^--=* ]]; thencontinue;fiecho &#34;LINE :: $line&#34;case $task inget)cmd=&#34;wget -o /dev/null -O - $line&#34;;;wol)cmd=&#34;sudo etherwake $$line&#34;;;*)cmd=&#34;$line&#34;;;esaceval $cmd &amp;gt;&amp;gt; $tempMaildone &amp;lt; &amp;lt;( sed &#39;1,/^$/ d&#39; $tmpFile|sed &#39;/^--$/,$ d&#39;)sendMail $sender &#34;Output result of command $task&#34; &#34;Happy Hacking&#34;rm $tmpFilerm $tmpMailrm $tempMail Related articles Who moved my Pi? Manage your servers the easy way with perl script over ssh with no remote client. ]]></content>
             </sphinx:document>
            
          
        </sphinx:docset>
