gpt4 book ai didi

linux - 如何为多个应用程序部署 web2py 调度程序?

转载 作者:太空狗 更新时间:2023-10-29 12:43:15 25 4
gpt4 key购买 nike

根据以下内容我需要创建如下文件:

/etc/init/web2py-scheduler.conf

http://web2py.com/books/default/chapter/29/13/deployment-recipes#Start-the-scheduler-as-a-Linux-service--upstart-

web2py-scheduler.conf

description "web2py task scheduler"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn limit 8 60 # Give up if restart occurs 8 times in 60 seconds.
exec sudo -u <user> python /home/<user>/web2py/web2py.py -K <myapp>
respawn

问题

如果我想要一个用于 2 个应用的调度器,我该怎么办?

我应该创建两个 .conf 文件还是创建一个包含 2 个 exec 命令 实例的文件?

有两个文件的解决方案是:

/etc/init/web2py-scheduler.app1.conf:

description "web2py task scheduler App1"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn limit 8 60 # Give up if restart occurs 8 times in 60 seconds.
exec sudo -u <user> python /home/<user>/web2py/web2py.py -K App1
respawn

/etc/init/web2py-scheduler.app2.conf:

description "web2py task scheduler App2"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn limit 8 60 # Give up if restart occurs 8 times in 60 seconds.
exec sudo -u <user> python /home/<user>/web2py/web2py.py -K App2
respawn

一个文件的解决方案:

/etc/init/web2py-scheduler.conf:

description "web2py task scheduler"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn limit 8 60 # Give up if restart occurs 8 times in 60 seconds.
exec sudo -u <user> python /home/<user>/web2py/web2py.py -K App1
exec sudo -u <user> python /home/<user>/web2py/web2py.py -K App2
respawn

抱歉,如果这很明显,但我没有编写 conf 文件以及系统的这一部分如何工作的经验。

谢谢

最佳答案

好吧,我认为两者都是可能的,我决定使用双文件解决方案。

完整文件如下(注意我把<user>换成www-data是实际用户):

/etc/init/web2py-scheduler.app1.conf:

description "web2py task scheduler App1"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn limit 8 60 # Give up if restart occurs 8 times in 60 seconds.
exec sudo -u www-data python /home/www-data/web2py/web2py.py -K App1
respawn

/etc/init/web2py-scheduler.app2.conf:

description "web2py task scheduler App2"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn limit 8 60 # Give up if restart occurs 8 times in 60 seconds.
exec sudo -u www-data python /home/www-data/web2py/web2py.py -K App2
respawn

一个文件的解决方案:

/etc/init/web2py-scheduler.conf:

description "web2py task scheduler"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn limit 8 60 # Give up if restart occurs 8 times in 60 seconds.
exec sudo -u www-data python /home/www-data/web2py/web2py.py -K App1,App2
respawn

在一个文件中 App1,App2中间不应有空格。

关于linux - 如何为多个应用程序部署 web2py 调度程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34744107/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com