iaxmodem
当我有多个调制解调器时,如何使用 Upstart 启动faxgetty
? Centos 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
答案1
使用在运行级别更改时启动的任务来为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