By Benreis (Own work) [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC-BY-3.0 (http://creativecommons.org/licenses/by/3.0)], via Wikimedia Commons

Vacation message using procmail

If you use procmail to filter messages, you can use it also to setup a vacation email response:

  1. Create a file called vacation.txt and fill it with your “vacation message”.
  2. Create a file called vacation.rc fill it with the following commands (and don’t forget to adjust the values for USER, DOMAIN, and PATHxxx to your needs):
:0 Whc: vacation.lock
* .*for <USER@DOMAIN>
* !^FROM_DAEMON
* !^X-Loop: USER@DOMAIN
| formail -rD 8192 vacation.cache
:0 ehc
| (formail -rA”Precedence: junk (autoreply)”
-A”X-Loop: USER@DOMAIN” ;
cat PATHTOVACATIONMESSAGE/vacation.txt
) | PATHTOSENDMAIL/sendmail -oi -t
  1. Find your .procmailrc file and add the following line after your filter commands (again adjust the PATH):
#INCLUDERC=PATHTORCFILE/vacation.rc

If you receive an email at USER@DOMAIN and it is not filtered out by your spam filter, the vacation commands are activated. It checks if the email is for you, does not originate from a mailing list, and has not been processed before. It also creates a file called vacation.cache, where it stores the email addresses to which a vacation message has already been sent, in order to do not send such a message again (don’t forget to delete it when you deactivate the vacation filter). At last it replies with the message stored in vacation.txt.

The “Precedence: junk (autoreply)” part helps to avoid bouncing messages from other MTAs.

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!

By luiscurse [CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0/)], via deviantART

Wonders of Typo3

A lot of people complain about Typo3. They say it is too heavy for a CMS. They may be right, it is complex and it takes some time to get used to it. But it pays!

Today a customer complained, that one of his pages in Typo3 was missing completely. He was right, it was not there any more. What happened? One of his employees accidentally deleted the wrong page … Which is not really a problem of Typo3. If you delete it, it is gone. It does not matter which system you are using … Well, problem for Typo3.

Unfortunately, content versioning was disabled, which made it a little bit more work:

  • open the database
  • find the page (write down the pid)
  • change deleted from 1 to 0
  • repeat those steps for all content entries with that pid
  • return to the administrator of Typo3
  • move the page to its correct location
  • reposition the content inside the page

… done in 5 minutes … with content versioning enabled it would have been a simple click …

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!

Howto shutdown Linux box automatically?

a single one-time shutdown:

e.g. shutdown your linux box at 7:30 January 10th:

at 7:30 jan 10
> shutdown -h now
> CTRL-D

… make sure the at daemon is running e.g.:

/etc/init.d/atd start

… or for SuSE:

rcatd start

… and check your at queue:

atq

scheduled shutdowns at certain intervals:

e.g. kill your computer every day at midnight (to make sure you get enough sleep):

crontab -e -u root
> 0 0 * * * /sbin/shutdown -h now

… save and exit …

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!

By Jesus Presley [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons

Typo3 Sitemap Hacks

The creation of site maps in Typo3 is pretty straight forward. You can either use the built-in site-map function or the extension fl_seo_sitemap. The later has the advantage of being adjustable using CSS.

Have a look at an example for an human readable site map created using the SEO plugin.

For the automatic creation of a site map for Google in XML format, there exists another nice extension mc_googlesitemap. It provides not only functions to create site maps for the individual pages of the Typo3 CMS but also for database content such as news items. At our system, the site maps for content items did not like to work at first. A look at the source code showed the problem. We did not have the news items assigned to a news category. After doing so, the site map worked.

Here are examples for a Google site map for pages and a Google site map for content items.

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!

By Aka [Public domain], via Wikimedia Commons

MediaWiki Hacks III

To integrate RSS feeds there are a couple extensions for MediaWiki. The most up to date extension seems to be GISWiki/RSS which uses Magpie RSS as back end to fetch the RSS feeds.

To enable blogger atom feeds some tweaks are necessary to match the different formats:

Find the comment “# Bild items” and enter the following lines into the following foreach loop:

if (isset($item['atom_content'])) {
 $item['description'] =&amp; $item['atom_content'];
 $item['date_timestamp'] = parse_w3cdtf($item['published']);
}

Above the “# Bild items” comment there is another foreach loop. Place the following lines inside that loop right after the if statement:

if (isset($item['atom_content']) &amp;&amp; $item['atom_content']) {
 $description = true; break;
}

Because we did not want to show the complete description, we added the following function to truncate the text:

function mTruncate($string, $length = 200, $etc = ' ...') {
 if ($length == 0) return '';
 $string = strip_tags($string);
 if (strlen($string) &lt;= $length) return $string;       
 $length -= strlen($etc);       
 return substr(preg_replace('/s+?(S+)?$/', '',     
   substr($string, 0, $length+1)), 0, $length).$etc; 
}

To activate the truncate function we changed the following line:

if ($text) $output.="n$text";

to

if ($text) $output .= "n" . mTruncate($text);

multilang breaks the NOSECTIONEDIT magic word

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!