首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在Ubuntu上作为守护进程运行Sidekiq

在Ubuntu上作为守护进程运行Sidekiq
EN

Stack Overflow用户
提问于 2013-03-20 18:14:19
回答 2查看 14.9K关注 0票数 21

我如何在Ubuntu上以守护进程的形式运行sidekiq?

如果我运行bundle exec sidekiq -D,我得到了invalid option: -D,有没有办法在没有其他控制器的情况下运行它,比如上帝,暴发户……?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-03-20 18:28:48

有一个选项来守护sidekiq,只需传递-d选项

commit

票数 30
EN

Stack Overflow用户

发布于 2020-07-05 17:27:12

对于Sidekiq版本6或更高版本,不支持作为Unix运行程序的守护程序。相反,我们必须将流程作为服务运行。

根据您的bundler位置编写一个脚本,或者您可以修改以下代码片段并将其复制到/usr/lib/systemd/system (CentOS)或/lib/systemd/system (Ubuntu)中

[Unit]
Description=sidekiq

After=syslog.target network.target

[Service]

Type=notify
WatchdogSec=10
WorkingDirectory=/home/deploy/apps/project_name

# If you use rbenv:
# ExecStart=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec sidekiq -e production'
# If you use the system's ruby:
# ExecStart=/usr/local/bin/bundle exec sidekiq -e production
# If you use rvm in production, don't.

#ExecStart=/home/deploy/.rvm/wrappers/ruby-2.6.5/bundle exec sidekiq -e production

# Use `systemctl kill -s TSTP sidekiq` to quiet the Sidekiq process
# !!! Change this to your deploy user account !!!

User=deploy

Environment=MALLOC_ARENA_MAX=2

# if the script crash, restart
RestartSec=1
Restart=on-failure

# output goes to /var/log/syslog (Ubuntu) or /var/log/messages (CentOS)
StandardOutput=syslog
StandardError=syslog

# This will default to "bundler" if we don't specify it
SyslogIdentifier=sidekiq
[Install]
WantedBy=multi-user.target

确保您为ExecStart提供了正确的捆绑程序路径,以便启动该进程。将其另存为sidekiq.service并运行systemctl enable sidekiq。然后,我们可以使用命令systemctl start sidekiqsystemctl stop sidekiqsystemctl restart sidekiq来管理该过程。

我们可以使用journalctl -u sidekiq -rn 100查看最后100行日志。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15520676

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档