我试图改变顶部日志间隔CentOS 7 cPanel 服务器从600到60秒并尝试编辑文件/etc/system/system/multi-user.target.wants/atop.service
(Environment="LOGINTERVAL=60")并执行了service atop restart
,然后编辑/usr/share/atop/atop.daily
(LOGINTERVAL=60)并执行了,service atop restart
但没有看到预期的结果。
因此,我尝试编辑/usr/lib/systemd/system/atop.service
(环境=“LOGINTERVAL=60”),我看到service atop status
之后当我检查时,service atop status
我看到一个警告Warning: atop.service changed on disk. Run 'systemctl daemon-reload' to reload units.
[root@**** ~]# service atop status
Redirecting to /bin/systemctl status atop.service
● atop.service - Atop advanced performance monitor
Loaded: loaded (/usr/lib/systemd/system/atop.service; enabled; vendor preset: disabled)
Active: active (running) since *** ****-**-** **:**:** GMT; 29min ago
Docs: man:atop(1)
Process: 20856 ExecStartPost=/usr/bin/find ${LOGPATH} -name atop_* -mtime +${LOGGENERATIONS} -exec rm -v {} ; (code=exited, status=0/SUCCESS)
Process: 20852 ExecStartPre=/bin/sh -c test -n "$LOGGENERATIONS" -a "$LOGGENERATIONS" -eq "$LOGGENERATIONS" (code=exited, status=0/SUCCESS)
Process: 20851 ExecStartPre=/bin/sh -c test -n "$LOGINTERVAL" -a "$LOGINTERVAL" -eq "$LOGINTERVAL" (code=exited, status=0/SUCCESS)
Main PID: 20855 (atop)
CGroup: /system.slice/atop.service
└─20855 /usr/bin/atop -w /var/log/atop/atop_******** 600
*
*
*
Warning: atop.service changed on disk. Run 'systemctl daemon-reload' to reload units.
[root@**** ~]# service atop restart
Redirecting to /bin/systemctl restart atop.service
Warning: atop.service changed on disk. Run 'systemctl daemon-reload' to reload units.
[root@**** ~]# service atop status
Redirecting to /bin/systemctl status atop.service
● atop.service - Atop advanced performance monitor
Loaded: loaded (/usr/lib/systemd/system/atop.service; enabled; vendor preset: disabled)
Active: active (running) since *** ****-**-** **:**:** GMT; 5s ago
Docs: man:atop(1)
Process: 25789 ExecStartPost=/usr/bin/find ${LOGPATH} -name atop_* -mtime +${LOGGENERATIONS} -exec rm -v {} ; (code=exited, status=0/SUCCESS)
Process: 25785 ExecStartPre=/bin/sh -c test -n "$LOGGENERATIONS" -a "$LOGGENERATIONS" -eq "$LOGGENERATIONS" (code=exited, status=0/SUCCESS)
Process: 25784 ExecStartPre=/bin/sh -c test -n "$LOGINTERVAL" -a "$LOGINTERVAL" -eq "$LOGINTERVAL" (code=exited, status=0/SUCCESS)
Main PID: 25788 (atop)
CGroup: /system.slice/atop.service
└─25788 /usr/bin/atop -w /var/log/atop/atop_******* 600
*
*
*
Warning: atop.service changed on disk. Run 'systemctl daemon-reload' to reload units.
此时我应该怎么做?我没有尝试运行,systemctl daemon-reload
因为我不确定它会带来什么变化
答案1
正如解释的那样systemctl(1),
daemon-reload
重新加载 systemd 管理器配置。这将重新运行所有生成器(请参阅systemd.generator(7))、重新加载所有单元文件并重新创建整个依赖关系树。在重新加载守护进程时,systemd 代表用户配置监听的所有套接字都将保持可访问。
但是,您不应编辑下面的单元,/usr/lib/systemd/
因为它们由 RedHat 软件包管理器 (RPM) 控制,并将被更新替换。请参阅正确的路径systemd.unit(5) 单元文件加载路径。
小路 | 描述 |
---|---|
/etc/systemd/系统 | 管理员创建的系统单元 |
在 /usr/local/lib/systemd/系统 | 管理员安装的系统单元 |
/usr/lib/systemd/系统 | 发行版包管理器安装的系统单元 |
你可以将你的设置设置为放下在/etc/systemd/system/atop.service.d/interval.conf
:
[Service]
Environment=LOGINTERVAL=60
之后,是的,您需要运行sudo systemctl daemon-reload
。