Articles of systemd

由于依赖关系更新,启动停止服务

我有两个systemd服务: postgresql.service和app.service 。 postgresql.service是发行版提供的(ubuntu 15.10), app.service是我自己编写的。 由于app需要postgresql ,该服务如下所示: [Unit] Description=Start App Requires=postgresql.service After=postgresql.service [Install] WantedBy=multi-user.target [Service] Restart=always ExecStart=/path/to/app 今天postgresql得到更新。 当然,它自动更新后重新启动postgresql.service 。 但是这杀了我的app.service ,因为它需要postgresql : # systemctl status app […] Apr 08 12:04:42 host systemd[1]: Stopping Start App… Apr 08 12:04:42 host systemd[1]: Stopped Start App. Apr 08 12:04:42是postgresql更新发生的时间。 如何更改app.service ,使其不会在postgresql重新启动时被简单地杀死,但是(重新启动)也会自动启动(当然,只有当启用时)。 或者问一个问题:如何configurationapp.service ,当app.service被启用时,它始终会在postgresql.service之后自动启动? 所以基本上systemctl start postgresql首先启动postgresql […]

CentOs 7:如果HTTP侦听特定的IP地址,它将不会在启动时启动

我在我的httpd.conf中有这个: Listen 216.XX.YY.ZZZZ:80 只是为了确保,我确保在启动时启用httpd: systemctl httpd enable 系统启动时 ,我有: systemctl status httpd ● httpd.service – The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2017-02-23 22:21:03 PST; 8min ago Process: 719 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 719 (code=exited, status=1/FAILURE) Feb 23 22:21:00 centosXXXXXX.aspadmin.net systemd[1]: Starting […]

延迟NIS和NFS启动,直到Fedora 17上的networking接口完全准备就绪

我最近为我们的networkingbuild立了一个Fedora 17服务器,而且我一直在启动NIS服务时遇到问题。 以下是系统中的一些日志: Aug 21 12:57:12 cairnwell ypbind-pre-setdomain[718]: Setting NIS domain: 'indigo-nis' (environment variable) Aug 21 12:57:13 cairnwell ypbind: Binding NIS service Aug 21 12:57:13 cairnwell rpc.statd[730]: Unable to prune capability 0 from bounding set: Operation not permitted Aug 21 12:57:13 cairnwell systemd[1]: nfs-lock.service: control process exited, code=exited status=1 Aug 21 12:57:13 cairnwell systemd[1]: Unit […]

系统暂停 – 没有看到dbus上电信号

当系统从挂起状态恢复时,我想通过dbus获取通知。 遵循这些现有的问题: 在系统暂停时发送什么样的DBus信号? 当我的系统在python应用程序中通过DBus或类似的方式从挂起状态唤醒时,我该如何检测? 但是,当我暂停或恢复时,上述链接中find的示例都不会触发。 dbus-monitor也没有看到任何东西: dbus-monitor –system "type='signal',interface='org.freedesktop.UPower'" 我也尝试使用这个代码手动发射信号(更容易): #taken from /usr/lib/systemd/system/upower.service dbus-send –system –type=signal –dest=org.freedesktop.UPower \ /org/freedesktop/UPower org.freedesktop.UPower.Resuming 同样的结果。 我必须错过一些非常明显的东西。 Fedora 20 x86_64。 (dbus安装好了,运行正常,AFAICT工作正常)Fedora 20使用logind ,但是在那里我看不到任何“恢复”信号。 挂起和恢复很难用VirtualBox进行testing,所以我无法真正与其他操作系统进行比较。 有趣的是,QDBUS看到很多服务(org.gnome.SessionManager等),但没有任何电力相关的,但是,然后再次,它不会看到login1 .. qdbus | grep -i power | wc -l 0

如何使用systemd做策略路由?

我需要在使用systemd的CoreOS实例上进行策略路由。 但是我还没有find关于如何使用systemd-network的文档或例子。 我怎么做? 到目前为止,我只设法通过向一个新文件/etc/iproute2/rt_tables添加一个条目来创build另一个路由表,并且它被命令行工具识别。 最终,我在同一子网上有两个独立的路由器。 我想确保从一台路由器发往我的主机的stream量由同一台路由器返回。

如何获得systemctl的反馈?

我缺less一些systemd命令的反馈。 发行后 systemctl restart my_service 没有输出,并接收确认,如果my_service启动,我需要键入 systemctl status my_service 是否有办法至less有一行解释系统做了什么,也可能如果服务未能启动或成功?

在CentOS 7 SystemD上创build多个Apache实例

我试图在CentOS 7上systemd中创build一个重复的httpd服务(为什么?见底部) 这是我迄今为止所做的: #Copy all the files cp -pr /etc/httpd /etc/httpd-bobby cp /usr/lib/systemd/system/httpd.service /usr/lib/systemd/system/httpd-bobby.service cp /etc/sysconfig/httpd /etc/sysconfig/httpd-bobby #Just replace /etc/sysconfig/httpd with /etc/sysconfig/httpd-bobby pico /usr/lib/systemd/system/httpd-bobby.service #Changed port and file locations pico /etc/httpd-bobby/conf/httpd.conf 当我运行它,我得到一个失败,而这: [root~]# systemctl status httpd-bobby.service httpd-bobby.service – The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd-bobby.service; disabled) Active: failed (Result: exit-code) since Tue 2016-06-21 17:38:33 BST; […]

系统启动的uwsgi进程在一段时间后closures

所以我写了这个简单的systemd服务脚本: [Unit] Description=uwsgi server script [Service] User=web Group=web WorkingDirectory=/var/www/prod/myproject/releases/current ExecStart=/bin/bash -c 'source ~/.bash_profile; workon myproject; uwsgi –ini /var/www/prod/myproject/releases/current/myproject/uwsgi_prod.ini' [Install] WantedBy=multi-user.target 工作正常 – 它启动,我可以看到我的uwsgi进程htop 。 但是,闲置5分钟后莫名closures。 如果我在bash控制台手动启动这个过程,通过执行,作为web用户: – source ~/.bash_profile workon myproject uwsgi –ini /var/www/prod/myproject/releases/current/myproject/uwsgi_prod.ini 我的过程闲置后不会死亡。 问题是什么?

Arch Linux下的systemd httpd stop很慢

当我执行一个: systemctl stop httpd Apache经常需要几分钟的时间来停止 命令: apachectl gracefully-stop 总是立即停止。 任何人有任何想法可能会导致这个? 命令: systemctl start httpd 和 apachectl start 都跑得很快。 不知何故,这是systemd和停止httpd相关(可能与Arch Linux相关)。

用systemd启动一个程序

我试图将最新版本的ProFTPd(1.3.5)安装到CentOS 7盒子上,最后不得不手动configuration和安装。 原因是EPEL的proftpd版本不包含mod_sftp (尽pipe它包含mod_tls )。 这是EPEL版本安装时proftpd -l的输出: [root@blah /]# proftpd -l Compiled-in modules: mod_core.c mod_xfer.c mod_rlimit.c mod_auth_unix.c mod_auth_file.c mod_auth.c mod_ls.c mod_log.c mod_site.c mod_delay.c mod_facts.c mod_dso.c mod_ident.c mod_readme.c mod_auth_pam.c mod_tls.c mod_memcache.c mod_cap.c mod_ctrls.c mod_lang.c 使用这个家伙的方法,我认为他使用的是CentOS 6 ,我用下面的configuration来configurationproftpd: ./configure –prefix=/usr –with-includes=/usr/local/ssl/include –with-libraries=/usr/local/ssl/lib –enable-openssl –with-modules=mod_sftp –enable-dso 然后我就可以运行make并成功make install 。 问题是,它看起来不像它创build任何systemd脚本: [root@localhost]# systemctl start proftpd.service Failed to issue method […]