Creating a vacation message in CentOS

This is a quick post showing how we used Chris Samuel’s vacation program to add quick auto-responder support to a mail set up on a CentOS box. Here’s the existing situation: we run a CentOS 5.8 box that provides alias services for email. In other words, it maps bchapman@law.emory.edu to bjchapm@emory.edu. This is handled via text entries in the /etc/aliases file. Most users do not have a real account on the machine that hosts the aliases file.

We want to let our users know that a particular email address is no longer valid and can no longer be used. In this case, we want them to know that they cannot email “elshelpdesk@law.emory.edu” to request help with computer issues. We currently have elshelpdesk configured via the aliases file to forward to another account. That account fed our old help desk system, which we have just recently retired. Now that we are using a new help system, we need to let the users know that they will need to re-submit their request using another method.

In the old days, I would have used procmail for this task. However, Chris Samuel’s port of vacation looks like an easier approach to this. Here’s how we got it to work:

Installation

Install the gdbm development library (as root or using sudo):  yum install gdbm-devel

Fetch the vacation software from Chris’s site and expand the archive:

$ tar xvfz vacation-1.2.7.1.tar.gz

Change into the directory and make one small change to the Makefile

$ cd vacation-1.2.7.1

Use your favorite editor to edit the Makefile). Locate line 48 and change it from:

MANDIR          = $(PREFIX)/man/man

to

MANDIR          = $(PREFIX)/share/man/man

This solves a tiny bug (at least for me) that prevents the manual pages from installing correctly. Now type “make” and “make install”. The program should compile cleanly and should install without errors.

Configuration and Usage

Our user is “virtual”. Our first requirement is to change the elshelpdesk user to be an actual user of the system. Create the elshelpdesk user (“adduser elshelpdesk”) and set the password to something secure. Remove or comment out the entry in /etc/aliases for elshelpdesk. Now become that user (from root, do “su – elshelpdesk”).

As “elshelpdesk”, type “vacation”. This will automatically configure a .forward file for this user and also launches the default editor (usually vi or vim) so that you can edit the message. If you don’t want to use vim, you can set the EDITOR environment variable to the name of another editor before you launch vacation. For example, if you would prefer to use  nano rather than vim, do “export EDITOR=nano” before launching the vacation interactive session.

Once you’ve run “vacation”, it will remain active until you remove the file called .forward that is located in the home directory of the user. For more information, take a look at the vacation manual pages: “man vacation”.

Is there a better way or a different way to accomplish the same task on a CentOS machine? Let us hear from you in the comments.

Advertisements

2 thoughts on “Creating a vacation message in CentOS

  1. lance says:

    hi,

    was looking for a Centos implementation of vacation(1) as i’ve used it many time over the years since the 80’s. thanks for posting this, letting me find the source.

    One comment is that the .forward file sends the mail to both the vacation program as well as the user account

    \elshelpdesk, “|/usr/bin/vacation elshelpdesk”

    eventually /usr/spool/mail/elshelpdesk will fill the disk. it may take time, but any growing and unread mailbox will eventually hit disk limits.

    for an unread mailbox (like an old help desk address), you may want to remove the \elshelpdesk, portion of the .forward file contents.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s