Centos

用 upstart 啟動 iaxmodem 和faxmodem

  • July 9, 2018

當我有多個調製解調器時,iaxmodem如何使用 Upstart 啟動?faxgettyCentos 6.4 有一個很好的警告,如下所示,它讓我相信標準inittab行不起作用。

# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.

我通常會放的地方

IAX:2345:respawn:/path/to/iaxmodem ttyIAX

使用在執行級別更改時啟動的任務為IAXModem您要啟動的每個任務啟動一個作業。然後使用一個任務faxgetty為每個已啟動的iaxmodem作業啟動一個。

IE:

init 3 -> start-iaxmodem ---> iaxmodem(ttyIAX0) -> start-faxgetty(ttyIAX0) -> faxgetty(ttyIAX0)
                         \-> iaxmodem(ttyIAX1) -> start-faxgetty(ttyIAX1) -> faxgetty(ttyIAX1)

/etc/init/start-iaxmodems.conf:

# This service starts the configured number of gettys.
start on stopped rc RUNLEVEL=[2345]

task

script
   for ttyIAX in /etc/iaxmodem/* ; do
       start iaxmodem TTY=`basename $ttyIAX`
   done
end script

/etc/init/iaxmodem.conf:

# This service maintains an iaxmodem on the sepcified device.
stop on runlevel [016]

respawn
instance $TTY
exec /usr/sbin/iaxmodem $TTY

/etc/init/start-faxgettys.conf:

# This service starts the configured number of faxgettys.
start on started iaxmodem
# this will run once per triggering iaxmodem instance
instance $INSTANCE

task

script
   # give it time to at least create the device
   /bin/sleep 1s
   start faxgetty TTY=$INSTANCE
end script

/etc/init/faxgetty.conf:

# This service maintains a faxgetty on the sepcified device.
# only stop when the stopping iaxmodem is this TTY
stop on stopping iaxmodem INSTANCE=$TTY

respawn
instance $TTY

exec /usr/sbin/faxgetty $TTY

引用自:https://serverfault.com/questions/555873