我有一个类似守护进程的进程,它启动了两个子进程(其中一个子进程启动了约10个其他子进程)。当systemctl stop我的进程出现时,子进程似乎被“积极地”杀死了systemctl-这并没有给我清理进程的机会。
我如何才能摆脱systemctl stop侵略性的杀戮,从而使我的流程有序地进行清理?
我timeoutSec=30无济于事。
我想创建一个systemd服务,可以使用systemctl start手动启动它,但是我不希望它在系统重启时自动运行。我该怎么做呢?
(系统版本 229)
我有一个主服务A和一个辅助服务B。主服务A可以自行运行。但是服务 B 本身无法正确运行:它需要 A 运行(技术上 B可以运行,但这是我想要systemd阻止的)。我的目标:如果A不运行,B就不应该运行。假设 A 和 B 正在运行,当 A 停止或死机/崩溃时,B 应该停止。
我该如何实现这一目标?
我通过将 [Unit] 项目添加到 b.service 来接近,使用
Requisite=A.service
After=A.service
Run Code Online (Sandbox Code Playgroud)
上面的结果就是
我该如何解决最后这个行为?似乎PartOf都BindsTo不起作用,但也许我没有正确的选项组合咒语?从手册页中我不清楚可以组合哪些选项。
systemd.unit 手册页:https://www.freedesktop.org/software/systemd/man/systemd.unit.html 相关:Systemctl 依赖失败,停止依赖服务
我想使用此图像https://hub.docker.com/_/amazonlinux来编写我的 EC2 机器的脚本
\n\n这是我的文档:
\n\nFROM amazonlinux:2\n\nMAINTAINER "xxxxx" <xxxxx@xxxx.xx>\n\nRUN yum -y update\nRUN yum -y install httpd\n\nWORKDIR /var/www/html\n\nCMD [ "/usr/sbin/httpd","-D","FOREGROUND" ]\nRun Code Online (Sandbox Code Playgroud)\n\nsystemctl 不起作用:
\n\nbash-4.2# systemctl list-units\nFailed to get D-Bus connection: Operation not permitted\nRun Code Online (Sandbox Code Playgroud)\n\nbash-4.2# systemctl status httpd.service\nFailed to get D-Bus connection: Operation not permitted\nRun Code Online (Sandbox Code Playgroud)\n\n我无法重新启动
\n\nbash-4.2# systemctl restart httpd.service\nFailed to get D-Bus connection: Operation not permitted\nRun Code Online (Sandbox Code Playgroud)\n\n/etc/os-release
\n\nbash-4.2# cat /etc/os-release\nNAME="Amazon Linux"\nVERSION="2"\nID="amzn"\nID_LIKE="centos rhel fedora"\nVERSION_ID="2"\nPRETTY_NAME="Amazon Linux 2"\nANSI_COLOR="0;33"\nCPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"\nHOME_URL="https://amazonlinux.com/"\nRun Code Online (Sandbox Code Playgroud)\n\n在真正的 ec2 上没有问题:
\n\n[ec2-user@ip-xxxxxxxxx]$ …Run Code Online (Sandbox Code Playgroud) 我有一个eth0.link文件来更改接口 eth0 的 MAC 地址。我想应用此更改而不重新启动。我试过
systemctl daemon-reload
systemctl daemon-reexec
systemctl restart systemd-networkd
Run Code Online (Sandbox Code Playgroud)
是否还有其他要重新启动的 .link 文件。
就像使用systemctl is-active <servicename>Gives 一样,如果服务处于活动状态或失败,那么是否可以使用 systemctl 获取 systemd 服务的正常运行时间或停机时间?
time systemctl status kdm|cat
* kdm.service - LSB: X display manager for KDE
Loaded: loaded (/etc/init.d/kdm; generated; vendor preset: enabled)
Active: active (exited) since Wed 2017-06-21 12:03:26 CEST; 1h 42min ago
Docs: man:systemd-sysv-generator(8)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/kdm.service
Run Code Online (Sandbox Code Playgroud)
是否可以使用 systemctl获得1 小时 42 分钟
Openshift原点通过安装ansible playbooks。
根据此文档,重新启动的正确命令是:
$ systemctl restart atomic-openshift-master-api atomic-openshift-master-controllers
Run Code Online (Sandbox Code Playgroud)
但是,这只会导致:
Failed to restart atomic-openshift-master-api.service: Unit not found.
Failed to restart atomic-openshift-master-controllers.service: Unit not found.
Run Code Online (Sandbox Code Playgroud)
通过on 安装后重新启动openshift origin(okd)的正确方法是什么?ansibleCentos7
我安装了最新版本的 nginx 并配置了一些目录:
./configure --sbin-path=/usr/bin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-pcre --pid-path=/var/run/nginx.pid --with-http_ssl_module
Run Code Online (Sandbox Code Playgroud)
一切正常。之后我创建了一个自定义文件:
nano /lib/systemd/system/nginx.service
Run Code Online (Sandbox Code Playgroud)
文件内容:
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/bin/nginx -t
ExecStart=/usr/bin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
但是当运行“systemctl start nginx”时,我收到错误“未找到单元”:
我不明白为什么或有什么问题。运行“nginx -V”显示目录已设置。
有人有线索吗?提前致谢
尽管 SLURM 在作业提交、运行和排队方面工作得很好,但我遇到了下面的一个小错误。
sudo systemctl status slurmd
Jun 12 10:20:40 noki-System-Product-Name systemd[1]: slurmd.service: Can't open PID file /var/run/slurm-llnl/slurmd.pid (yet?) after start: No such file or directory
sudo systemctl status slurmctld
Jun 12 10:20:40 noki-System-Product-Name systemd[1]: slurmd.service: Can't open PID file /var/run/slurm-llnl/slurmd.pid (yet?) after start: No such file or directory
我按照指南进行了安装
文件:///home/noki/Downloads/Webinar_2_Slurm_II--Ubuntu16.04_and_18.04.pdf
这个问题可能来自slurm.conf文件的所有权?
这是我的 slurm.conf 和 slur*.pid 的所有权
# slurm.conf file generated by configurator easy.html.
# Put this file on all nodes of your cluster.
# See the slurm.conf man page …Run Code Online (Sandbox Code Playgroud) 我的操作系统是Debian 10(Buster),4.19内核,Tomcat9似乎不稳定。
\n\n我不想在运行“systemctl status tomcat9.service”命令时看到任何错误消息。
\n\n但是,“systemctl status tomcat9.service”命令打印错误消息。
\n\n\xe2\x97\x8f tomcat9.service - Apache Tomcat 9 Web Application Server\n Loaded: loaded (/lib/systemd/system/tomcat9.service; enabled; vendor preset: enabled)\n Active: failed (Result: exit-code) since Tue 2020-03-03 21:02:15 KST; 12min ago\n Docs: https://tomcat.apache.org/tomcat-9.0-doc/index.html\n Process: 25999 ExecStartPre=/usr/libexec/tomcat9/tomcat-update-policy.sh (code=exited, status=226/NAMESPACE)\n\nMar 03 21:02:15 doonas.com systemd[1]: Starting Apache Tomcat 9 Web Application Server...\nMar 03 21:02:15 doonas.com systemd[25999]: tomcat9.service: Failed to set up mount namespacing: No such file or directory\nMar 03 21:02:15 doonas.com systemd[25999]: tomcat9.service: Failed at step …Run Code Online (Sandbox Code Playgroud)