我对 syslog、rsyslog 和 syslog-ng 有点困惑。
我可以从哪里获得 的源代码syslog()?
rsyslog 和 rsyslogd 之间有什么区别吗?
我有一项服务foo,目前从运行级别3及更高级别开始。我怎样才能在不使用的情况下阻止它这样做update-rc.d foo stop 3 .,它(如果我理解正确的话)会在每次运行级别更改时关闭服务。
(即,如果我处于运行级别1并启用foo,那么当我更改为运行级别3 时,它将被禁用,不是吗?)
运行 Debian GNU/Linux Lenny。
我有一个守护进程,/var/run它的 PID 文件需要自己的目录,并授予守护进程的用户写权限。
我发现我可以使用以下命令创建这个目录:
# mkdir /var/run/mydaemon
然后我可以将其所有权更改为我希望在其下运行该进程的用户/组:
# chown myuser:myuser /var/run/mydaemon
但是每当我重新启动时,这个目录就会消失!每次机器启动时如何创建这个目录?
我找到了这个 systemd 服务文件来启动 autossh 以保持 ssh 隧道:https : //gist.github.com/thomasfr/9707568
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
# LOCALPORT:IP_ON_EXAMPLE_COM:PORT_ON_EXAMPLE_COM
ExecStart=/usr/bin/autossh -M 0 -N -q -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -p 22 -l autossh remote.example.com -L 7474:127.0.0.1:7474 -i /home/autossh/.ssh/id_rsa
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
有没有办法将 systemd 配置为在一个服务中启动多个隧道。
我不想创建N个系统服务文件,因为我想避免复制+粘贴。
除了“remote.example.com”将替换为其他主机名之外,所有服务文件都将相同。
我大约在 1.5 年前问过这个问题。
我的想法变了。是的,这很好,你可以用 systemd …
Supervisord 不附带初始化脚本或不指示如何自动启动它,即。重启后。我尝试了一些用户提供的 /etc/init.d 脚本,但它们都失败了。
什么是首选的解决方案?
我已经从 MacPorts 在我的 Mac 上安装并配置了 nginx 服务器
sudo port install nginxnginx.conf.example到nginx.conf并改名mime.types.example来mime.types。它工作正常,但我无法阻止它。
我试过了sudo nginx -s stop,但这并没有停止服务器,我仍然可以看到“欢迎使用 nginx!” 页面在我的浏览器上http://localhost/;此外,我仍然看到 nginx 的主进程和工作进程ps -e | grep nginx。
在 Mac 上启动/停止 nginx 的最佳方法是什么?
顺便说一句,我添加了“守护进程关闭”;进入 nginx.conf - 根据各种资源的推荐。
我在 Raspbian Jessie 上使用 Systemd 设置了 node.js 应用程序形式的服务,它使用自己的用户帐户。但是,我发现该服务无法正常运行,因为它没有必要的权限。我安装的节点模块之一需要 root 访问权限。如果我使用 sudo 手动运行应用程序,一切正常。
有没有办法告诉 systemd 使用 sudo 运行服务?
我不知道这是如何发生的。发行版是 Scientific Linux 6.1,一切都设置为通过公钥执行身份验证。然而,当 sshd 作为守护进程运行时(service sshd start),它不接受公钥。(为了获取这段日志,我已经更改了 sshd 脚本以添加 -ddd 选项)
debug1: trying public key file /root/.ssh/authorized_keys
debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 0/0 (e=0/0)
debug1: trying public key file /root/.ssh/authorized_keys2
debug1: restore_uid: 0/0
Failed publickey for root from xxx.xxx.xxx.xxx port xxxxx ssh2
debug3: mm_answer_keyallowed: key 0x7f266e1a8840 is not allowed
debug3: mm_request_send entering: type 22
debug3: mm_request_receive entering
debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa
debug3: Wrote 64 bytes for a total of 1853
debug1: userauth-request for user root service ssh-connection …Run Code Online (Sandbox Code Playgroud) 每当尝试以普通用户身份停止/启动守护程序时,我都会遇到一个奇怪的问题,它要求使用另一个普通用户的凭据进行身份验证 - 例如:
[bob@server ~]$ systemctl stop some-daemon.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: alice
Password:
Run Code Online (Sandbox Code Playgroud)
为什么在bob登录时要求alice进行身份验证,我该如何解决?
我在 Ubuntu 9.04 服务器安装上有 60 个控制台套件守护程序实例。杀死这些进程或停止这些进程是否安全。它们似乎各自占用了大约 20% 的 RAM(参见 htop)。