Articles of systemd

如何列出systemd中的所有单元,而不pipe它们的状态如何,包括参数化/模板化(@)?

OpenVPN单元文件被参数化(参见@ ): > ls /usr/lib/systemd/system/openvpn* /usr/lib/systemd/system/[email protected] 问题是我无法通过systemctl命令列出参数化的服务名称,如果它们被禁用,即使使用选项–all : > systemctl –full –all -t service | grep openvpn 不过,我仍然可以列出非参数化禁用服务的名称(本例中为iptables ): > systemctl –full –all -t service | grep iptables iptables.service loaded inactive dead IPv4 firewall with iptables 如何获得所有单位的列表,即使其中一些参数化? 问题其实更加复杂(我可以轻松地列出可用的单元文件来回答自己)。 但是,问题在于不一致。 [email protected]服务启用时,可以通过上述命令列出。 当[email protected]服务被禁用时,它不能。 这似乎是一个明显的bug(或限制systemd不太了解参数化服务是否在我们启用时实际configuration)的事实。 不过,我宁愿问人群,也不要跳出这个结论。

仅当在Fedora 20上作为系统服务运行时,才会出现PHP-FPM错误(未find文件/未find主脚本)

我试图在Fedora 20盒子上用PHP-FPM设置NGINX, 只有当启动php-fpm作为系统服务时,我才得到“File not found / Primary script unknown”错误。 我在默认的fastcgi.conf中使用了NGINX的默认设置。 (使用: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; ) 这里是相关的nginx.conf: root /var/www/index; index index.html index.php index.htm; location ~ \.php$ { try_files $uri = 404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi.conf; } 现在,当我直接从shell(以root身份)启动php-fpm时,一切正常,但是当我使用systemctl start php-fpm.service fpm systemctl start php-fpm.service我得到“文件未find/主脚本未知”错误。 这里是php-fpm.service的定义: [Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target [Service] Type=notify […]

如何configurationMySQL的PID文件的权限?

我知道MySQLd将创build一个在mysqld.service中设置的pid文件: ExecStart=/usr/bin/mysqld –pid-file=/run/mysqld/mysqld.pid 但是,它创build了具有660权限的文件,意味着非特权用户甚至不能读取它。 我希望我的用户能够读取它,以检查服务是否正在运行(对于我的i3状态栏)。 到目前为止,我已经能够用ExecStartPost钩子来做到这ExecStartPost : ExecStartPost=/usr/bin/chmod a+r /var/run/mysqld/mysqld.pid 但是我确定必须有其他方法来configuration它。 毕竟,我的其他服务和守护进程会生成更多宽容的pid文件。

系统失控开始服务

我正试图让一个CoreOS系统在Microsoft Azure上稳定运行,并且快到了。 我现在唯一的问题是系统在启动etcd和舰队方面似乎失去控制。 当我跑步 sudo systemctl status etcd.service 我有一个不断的线条阅读 Nov 11 03:47:54 Services1 systemd[1]: Started etcd. Nov 11 03:47:54 Services1 systemd[1]: Started etcd. Nov 11 03:47:54 Services1 systemd[1]: Started etcd. Nov 11 03:47:55 Services1 systemd[1]: Started etcd. Nov 11 03:47:55 Services1 systemd[1]: Started etcd. Nov 11 03:47:55 Services1 systemd[1]: Started etcd. Nov 11 03:47:55 Services1 […]

Play Framework 2.3的启动脚本为systemd?

我们升级到Play 2.3.x(使用激活器)和CentOS 7(使用systemd)。 以前在CentOS 6上,我们使用这个SysV初始化脚本来启动/停止/重启我们的各种Play应用程序。 现在有没有类似的系统的方法,大多数发行版已经迁移到它?

CentOS 7 – networking挂载和OpenSM的Systemctl依赖问题

我有以下问题。 我想在CentOS 7客户端上通过Infiniband挂载glusterfs共享。 glusterfs共享“/ data”被名为storage1的主机切断。 对于客户端II设置和最小的CentOS系统。 我安装rdma和opensm来运行opensm 。 两者都通过添加到引导序列 systemctl enable rdma.service systemctl enable opensm.service networking设备使用NetworkManager进行pipe理, ping storage1在ping storage1networking上正常工作。 然后我按照gluster文档中的描述添加了一个fstab条目: storage1:/data /net/data glusterfs defaults,acl,_netdev 0 0 当我现在重新启动系统时, net-data.mount服务失败。 启动完成后,我可以login并手动启动: systemctl start net-data.mount 一切正常。 在分析问题后,我发现所有使用客户端的普通以太网连接的其他networking共享(nfs,gluster)都是在启动时挂载的。 在这个journalctl我发现,对于Inifiniband来说,OpenSM在启动时太慢了。 在OpenSM完成启动之前5秒,上述共享的安装将被执行。 但是OpenSM的服务描述表明它是被network.target ,所以在networking共享被挂载之前就被盯上了。 所以我的问题是如何在引导序列的某个地方引入一个睡眠定时器,等待Inifinibandnetworking真的准备好/ OpenSM正在读取。 我不使用gluster的RDMAfunction。 OpenSM服务文件由yum / rpm安装: [Unit] Description=Starts the OpenSM InfiniBand fabric Subnet Manager Documentation=man:opensm DefaultDependencies=false Before=network.target […]

systemd logcheck规则不起作用

给出是这个logcheck规则: ^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ systemd-logind\[[[:digit:]]+\]: New session [[:digit:]]+ of user [^[:space:]]+\.$ 和这个日志条目: Mar 19 09:16:09 horst kernel: [3257039.867032] <38>systemd-logind[193047]: New session 24987 of user icinga. 这些似乎不匹配,不幸的是我找不到匹配(原文如此)的规则。 是的,这似乎是一个静态的数字。

systemd GitLab的单元文件

我目前正在编写一个Puppet模块来让GitLab在CentOS 6/7上运行。 对于CentOS 7安装,我需要编写一个systemd单元文件来启动gitlab服务(实际上是Unicorn&Sidekiq)。 下面是我根据对GitLab自己提供的初始化脚本的模糊理解提出的单元文件: [Unit] Description=GitLab After=network.target Requires=network.target After=mariadb.service Requires=mariadb.service After=redis.service Requires=redis.service [Service] EnvironmentFile=/etc/sysconfig/gitlab ExecStartPre=source /etc/profile.d/rvm.sh ExecStart=/bin/bash –pidfile=$UPID –user=$USER "$PATH_PATCH RAILS_ENV=$RAILS_ENV bin/web start" && /bin/bash –pidfile=$SPID –user=$USER "$PATH_PATCH RAILS_ENV=$RAILS_ENV bin/background_jobs start" [Install] WantedBy=multi-user.target 这里是关联的sysconfig文件: RAILS_ENV="production" USER=git APP_PATH=/home/$USER/gitlab UPID=$APP_PATH/tmp/pids/unicorn.pid ULOCK=/var/lock/subsys/unicorn SPID=$APP_PATH/tmp/pids/sidekiq.pid SLOCK=/var/lock/subsys/sidekiq PATH_PATCH="PATH=$(su $USER -s /bin/bash -l -c "echo \"\$PATH\"") && export PATH && " […]

系统.service文件中的libexecdir?

我使用RPM来部署机器(内部,而不是公共消费)。 现在,在RPM .spec文件中有%_libexecdirvariables。 软件包在该位置部署服务二进制文件。 我怎样才能在systemd .service文件的ExecStart= entry中自动使用该path? 没有相应的Bashvariables,例如,我不知道是否类似rpm –eval=%_libexecdir是一个好主意,甚至可能在.service中。

dovecot,postfix,systemctl start永不完成,神秘依赖

我已经安装了Xubuntu 15.04,并且马上就被迫深入了解systemd,systemctl,systemd-analysis的细节。 开箱即用,postfix挂在configuration部分的apt-get上。 所以dovecot。 到目前为止,我学到的是systemd是一个先进的服务pipe理系统,能够并行地启动事物,并具有依赖性等function。 我认为,通过apt-get(也包括突触)在安装结束时发生的configuration阶段的原因是服务本身无法启动,因为它正在等待依赖关系。 systemctl list-jobs告诉我dovecot是“开始等待”。 启动意义,它处于启动模式。 而等待意味着它在等待什么。 现在,我遇到的问题是,还在等什么呢? 我可以做像systemd-analyze plot , dot和其他所有的东西,但是没有一个选项或者组合能够告诉我它在等什么。 我可以看到所有依赖的东西,但哪一个是特别不开心的呢? 我不希望手动通过所有的依赖关系? 现在,让我的系统运行的唯一方法是在启动时忍受错误,然后使用systemctl –job-mode=ignore-dependencies start dovecot postfix来手动启动这些服务。 我一直在search,并找不到任何方式给我一个概述,包含所有基于状态的信息,如什么样的服务取决于什么,以及这些都是在什么状态。svg或svg从点转换,是不是告诉我这一点。