we2py------linux上运行scheduler

Start the scheduler as a Linux service (upstart)

To install the scheduler as a permanent daemon on Linux (w/ Upstart), put the following into /etc/init/web2py-scheduler.conf, assuming your web2py instance is installed in <user>'s home directory, running as <user>, with app <myapp>, on network interface eth0.

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

You can then start/stop/restart/check status of the daemon with:

sudo start web2py-scheduler
sudo stop web2py-scheduler
sudo restart web2py-scheduler
sudo status web2py-scheduler
上面是web2py文档中的原话,大意是如果你需要在linux上跑scheduler,你要在/etc/init目录下创建一个web2py-scheduler.conf的配置文件,配置文件中最重要的是:exec sudo -u <user> python /home/<user>/web2py/web2py.py -K <myapp>其中第一个<user>表明要用哪个用户运行,python后面的路径是你的web2py文件存放的路径, <myapp>是你要运行的app名称。
这是我的配置文件:
root@180:/etc/init# cat 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 root python /opt/linkDataAdmin/web2py/web2py.py -K linkDataAdmin
respawn
运行状态:
root@180:/etc/init# start web2py-scheduler
web2py-scheduler start/running, process 19619
root@180:/etc/init# status web2py-scheduler
web2py-scheduler start/running, process 19619
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值