2017-05-28 77 views
0

最近我遇到了systemd这个奇怪的问题,我有一个nodejs应用程序,我使用systemd运行,以及一切正常,直到我对应用程序代码进行任何更改并重新启动我的systemd服务,但是我新做的更改并不反映在执行中(除非我重新启动我的机器)。systemd不刷新更新应用程序代码

我观察的另一件事,如果我使用非常小的应用程序测试代码,然后它按预期工作,我的假设是我的应用程序代码大小可能会导致此行为。

在此先感谢。

[Unit] 
Description=sandbox 
Documentation=https://example.com 
PartOf=appbase.target 

[Service] 
ExecStart=/home/user/.nvm/versions/node/vx.x.x/bin/node /home/user/repo/Server/SandboxServer.js 
Restart=always 
Slice=limits.slice 
RestartSec=10      # Restart service after 10 seconds if node service crashes 
StandardOutput=syslog    # Output to syslog 
StandardError=syslog    # Output to syslog 
SyslogIdentifier=sandbox 

[Install] 
WantedBy=multi-user.target 

回答

0

问题在别处。当发出restart时,如果TERM信号不起作用,systemd将向应用程序发出TERM信号,然后发出KILL信号,最后,装置将开始备份。

您是否确认应用程序实际停止并启动?

您可以添加信号处理程序到TERM或KILL信号进行检查。