Upstart on CentOS 6+ and redir

By jbayer - Last updated: Friday, December 30, 2011 - Save & Share - Leave a Comment

This is a follow-up to the redir posting I made a while ago.

I had to install it on a CentOS 6.2 system.  Redhat (and CentOS) are now using upstart instead of the old System V inittab to control jobs.  Without getting into the reasons, while it gives greater flexibility, it is also more complicated.

To make redir start automatically, and to restart if it stops, I created the following small Upstart script.  To use it, just put it into a file:  /etc/init/redir.conf, and run the command below to tell init to reload the configuration files.  Be sure to replace the localIPaddress and smtp.<server> with your appropriate values.  This script assumes that redir is in /usr/local/sbin, replace it with wherever you put the program.

description "SMTP redirection using redir"
start on started
stop on shutdown
respawn
script
exec /usr/local/sbin/redir --lport=587 --laddr=<localIPaddress> --caddr=smtp.<server> --cport=25
end script

 

/sbin/initctl start redir

Posted in Administration, email • • Top Of Page
2,710 views

Write a comment

asd