Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Currently I have a crontab entry that does the following:

#!/bin/bash
/etc/init.d/sendmail stop
/etc/init.d/sendmail start
/usr/bin/newaliases

In the category of "learn something new every day", I just came across watch (http://ss64.com/bash/watch.html), and am wondering how to implement the updating of the sendmail aliases database via watching /etc/aliases for changes, rather than just blindly bouncing smtpd every day whether or not an update has occurred.

What is the right way of going about this, and should it still be run as a crontab entry, or can it be more-or-less daemonized?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If you're running Linux, there's inotify, and incron. In a manner similar to cron, incron can be configured to watch for filesystem change events (such as changes to configuration files like /etc/aliases), and to run processes in response.

share|improve this answer
    
I am on Linux (Ubuntu and CentOS) at the moment - these look pretty promising –  warren Oct 20 '10 at 15:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.