在 linux 上自动启动 postfix

enf*_*eld 4 linux postfix

我已经使用本指南在我的服务器上安装了 postfix http://www.postfix.org/INSTALL.html#install

基本上创建我自己的包并安装。现在我想在服务器重新启动时自动启动 postfix。

我尝试添加符号链接,chkconfig --add postfix但出现此错误:error reading information on service postfix: No such file or directory

我有 postfix 在服务器上运行得很好,期望这个。现在开始/停止后缀我使用

sudo postfix stop
sudo postfix start
Run Code Online (Sandbox Code Playgroud)

关于如何让它自己开始的任何想法?

Rei*_*Gil 5

chkconfig --add postfix在 init 脚本存储库中需要一个 postfix init 脚本,通常是/etc/init.d.

chkconfigupdate-rc.d(debian) 只是在 中操作脚本/etc/rc#.d/,其中#默认设置的启动运行级别是/etc/inittabinitdefaultterm 一致的。我的情况是:

id:2:initdefault:
Run Code Online (Sandbox Code Playgroud)

然后/etc/rc2.d/将调用符号链接。此链接的名称有一个模式[S|K]\d{1,}dstname,例如:

$ ls -l /etc/rc2.d/ | grep postfix
lrwxrwxrwx 1 root root  17 Ago 16 09:04 S22postfix -> ../init.d/postfix
Run Code Online (Sandbox Code Playgroud)

S 表示/etc/init.d/postfix start K 表示/etc/init.d/postfix stop

22是链接执行顺序。

然后您需要检查 inittab 以获取默认运行级别 ( initdefault),检查链接/etc/rcX.d( X is initdefault value), and have the link with a postfix startup script as target ( a script that supportstart for S prefix links andstop` 为 K 前缀链接 args)。

这就是 initsysv 系统的工作方式,但每个发行版都可能略有不同。