systemctl enable sidekiq:无法发出方法调用:访问被拒绝

systemctl enable sidekiq:无法发出方法调用:访问被拒绝

Systemd我正在尝试在 Ubuntu 16 上实现 Sidekiq 。

我已登录部署者。我导航到/lib/systemd/system目录并想在那里创建一个文件:nano sidekiq.service

但是,由于缺少权限,我收到了一条错误消息,因此我创建了该文件作为sudo nano sidekiq.service.全部创建成功。

然后,我想激活它,但收到此错误消息:

systemctl enable sidekiq => Failed to issue method call: Access denied

因此,我尝试使用sudo

sudo systemctl enable sidekiq => Failed to issue method call: No such file or directory

我该如何继续?如何激活这项新服务?

谢谢

编辑:来自 sudo journalctl -u sidekiq.service 的日志

-- Logs begin at Tue 2020-03-24 15:45:10 UTC, end at Wed 2020-03-25 10:18:41 U
Mar 25 10:15:31 ip-172-31-46-41 sidekiq[29413]: W, [2020-03-25T10:15:31.895985
Mar 25 10:15:31 ip-172-31-46-41 sidekiq[29413]: Association Tracking for Paper
Mar 25 10:15:31 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:15:31.913Z pid=2
Mar 25 10:15:35 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:15:34.999Z pid=2
Mar 25 10:15:35 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:15:35.008Z pid=2
Mar 25 10:15:35 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:15:35.008Z pid=2
Mar 25 10:15:35 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:15:35.008Z pid=2
Mar 25 10:16:55 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:16:55.393Z pid=2
Mar 25 10:16:55 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:16:55.394Z pid=2
Mar 25 10:16:55 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:16:55.394Z pid=2
Mar 25 10:16:55 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:16:55.895Z pid=2
Mar 25 10:16:57 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:16:57.898Z pid=2
Mar 25 10:17:05 ip-172-31-46-41 sidekiq[29581]: W, [2020-03-25T10:17:05.050918
Mar 25 10:17:05 ip-172-31-46-41 sidekiq[29581]: Association Tracking for Paper
Mar 25 10:17:05 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:17:05.072Z pid=2
Mar 25 10:17:07 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:17:07.903Z pid=2
Mar 25 10:17:07 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:17:07.904Z pid=2
Mar 25 10:17:07 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:17:07.904Z pid=2
Mar 25 10:17:07 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:17:07.904Z pid=2
Mar 25 10:18:28 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:18:28.944Z pid=2
Mar 25 10:18:28 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:18:28.944Z pid=2
Mar 25 10:18:28 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:18:28.945Z pid=2
Mar 25 10:18:29 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:18:29.446Z pid=2
Mar 25 10:18:31 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:18:31.449Z pid=2
Mar 25 10:18:38 ip-172-31-46-41 sidekiq[29614]: W, [2020-03-25T10:18:38.659569
Mar 25 10:18:38 ip-172-31-46-41 sidekiq[29614]: Association Tracking for Paper
Mar 25 10:18:38 ip-172-31-46-41 sidekiq[29614]: 2020-03-25T10:18:38.669Z pid=2

答案1

步骤假设如下:

  1. 创建文件sudo nano /lib/systemd/system/sidekiq.service
  2. 添加内容以sidekiq.service确保所有路径都可用。
  3. 重新加载 systemctl

    sudo systemctl daemon-reexec

    sudo systemctl daemon-reload

  4. 启用 sidekiqsudo systemctl enable sidekiq
  5. 现在你可以做sudo systemctl start|stop|restart sidekiq

如果审计日志出现问题,请尝试让我知道。确保您的服务已列入systemctl list-units --type=service | grep side

相关内容