1

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?

warren
  • 17,829
  • 23
  • 82
  • 134

1 Answers1

1

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.

Steven Monday
  • 13,019
  • 4
  • 35
  • 45