我正在尝试在我的服务器上设置Graphite。我可以毫无问题地启动 Carbon Cache 守护进程sudo /opt/graphite/bin/carbon-cache.py start,但我很难将它作为 Systemd 单元运行。
这是我的服务文件中的内容graphite.service:
[Unit]
Description=Carbon for Graphite
[Service]
ExecStart=/opt/graphite/bin/carbon-cache.py start
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
但是当我启动设备时,我得到以下状态:
$ systemctl status graphite.service
* graphite.service - Carbon for Graphite
Loaded: loaded (/etc/systemd/system/graphite.service; enabled)
Active: inactive (dead) since Fri 2014-06-13 18:44:11 UTC; 2s ago
Process: 4525 ExecStart=/opt/graphite/bin/carbon-cache.py start (code=exited, status=0/SUCCESS)
Main PID: 4525 (code=exited, status=0/SUCCESS)
Jun 13 18:44:11 MEADOW systemd[1]: Started Carbon for Graphite.
Run Code Online (Sandbox Code Playgroud)
Journalctl 不会产生更多信息。
我应该如何解释和调试状态为“inactive (dead)...(code=exited, status=0/SUCCESS)”的单元?我以前见过失败的单位,但这个单位已成功加载但未运行,我不知道这意味着什么。
这是我每次重新启动时的情况:
$ systemctl --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
nginx.service loaded failed failed A high performance web server and a reverse proxy server
...
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2014/01/18 05:44:47 [emerg] 254#0: open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed
$ cd /run
$ ls -al | grep nginx
$ sudo systemctl start nginx
$ ls -al | grep nginx
-rw-r--r-- 1 root root 4 Jan 18 06:27 nginx.pid …Run Code Online (Sandbox Code Playgroud) 我最终在我的 nix 商店中找到了错误的软件包来源。这发生在前一段时间,所以我无法追踪日志文件来弄清楚它是如何发生的。我为重新构建相同版本的包所做的任何尝试都会导致使用相同的错误源。有没有办法使源存档无效或强制重新获取?
我可以挂载商店rw并删除存档,但似乎应该有一个不破坏 nixosro设计的解决方案。