在我们的centos系统中,我们已经将teamcity代理configuration为systemd服务。 该服务工作正常,除非代理执行升级。 然后在执行升级时被杀死。 我想这是由于系统监视已创build的进程以及主进程何时存在以使第二进程执行升级系统决定这是一个丢失的进程并在大约一分钟之后将其终止。 我想这个假设得到validation的事实是,当我直接启动teamcity代理的升级工作没有问题。 这是服务的configuration: [Unit] Description=teamcity agent – local Requires=network.target After=network.target [Service] Type=forking PIDFile=/home/teamcityagent/logs/buildAgent.pid WorkingDirectory=/home/teamcityagent User=teamcityagent Group=teamcityagent ExecStart=/home/teamcityagent/bin/agent.sh start ExecStop=/home/teamcityagent/bin/agent.sh stop TimeoutStartSec=900 TimeoutStopSec=60 [Install] WantedBy=multi-user.target 到目前为止,我试图将超时改为900secs,并将PIDFile注释掉。 没有帮助。 有没有办法告诉systemd不要杀死升级过程,告诉它不要注意丢失的进程?
我尝试启用IP转发(在enp0s3和tun0接口之间),并在/etc/sysctl.conf写入net.ipv4.ip_forward = 1 。 重新启动后,我有 $ cat /proc/sys/net/ipv4/ip_forward 1 但转发仍然无法正常工作。 我尝试在/etc/sysctl.conf添加net.ipv4.conf.default.forwarding=1 。 现在重新启动后,我有 $ cat /proc/sys/net/ipv4/ip_forward 1 $ cat /proc/sys/net/ipv4/conf/default/forwarding 1 $ cat /proc/sys/net/ipv4/conf/all/forwarding 1 $ cat /proc/sys/net/ipv4/conf/enp0s3/forwarding 0 $ cat /proc/sys/net/ipv4/conf/tun0/forwarding 0 我无法在sysctl.conf启用/proc/sys/net/ipv4/conf/enp0s3/forwarding和/proc/sys/net/ipv4/conf/tun0/forwarding ,因为这些文件在如此早期的启动时间不存在: systemd-sysctl[85]: Couldn't write '1' to 'net/ipv4/conf/enp0s3/forwarding', ignoring: No such file or directory systemd-sysctl[85]: Couldn't write '1' to 'net/ipv4/conf/tun0/forwarding', ignoring: No […]
首先,我更愿意提到我已经find并阅读了这个 。 我使用标准的3.16内核运行Debian Jessie。 我已经手动定义了一个RAID1arrays。 但在启动时不会自动组装。 因此,在尝试挂载/ etc / fstab中描述的FS之后,systemd会回退到某些降级的shell。 如果fstab中的那一行被注释掉了,那么启动过程将结束,但RAIDarrays不可用。 手动组装不会引发任何错误。 然后安装FS很简单。 手动组装时,数组看起来像这样: root@tinas:~# cat /proc/mdstat Personalities : [raid1] md0 : active (auto-read-only) raid1 sdc1[0] sdd1[1] 1953382464 blocks super 1.2 [2/2] [UU] bitmap: 0/15 pages [0KB], 65536KB chunk unused devices: <none> 这里是blkid命令的摘录: /dev/sdd1: UUID="c8c2cb23-fbd2-4aae-3e78-d9262f9e425b" UUID_SUB="8647a005-6569-c76f-93ee-6d4fedd700c3" LABEL="tinas:0" TYPE="linux_raid_member" PARTUUID="81b1bbfe-fad7-4fd2-8b73-554f13fbb26b" /dev/sdc1: UUID="c8c2cb23-fbd2-4aae-3e78-d9262f9e425b" UUID_SUB="ee9c2905-0ce7-2910-2fed-316ba20ec3a9" LABEL="tinas:0" TYPE="linux_raid_member" PARTUUID="11d681e5-9021-42c0-a858-f645c8c52708" […]
我在Ubuntu 16.04上运行docker,并希望查看日志。 但是,我猜测是某种旋转或日志增长到一定的大小之后,我无法查看日志。 我没有对journald.conf做任何修改,所以我在那里使用默认值。 我所看到的例子: systemctl docker status确认服务since Thu 2016-10-13 18:56:28 UTC一直处于活动systemctl docker status 。 但是,当我运行像journalctl -u docker.service –until "2016-10-13 22:00" – 我得到的唯一的输出是– Logs begin at Fri 2016-10-14 01:18:49 UTC, end at Fri 2016-10-14 16:18:25 UTC. — — Logs begin at Fri 2016-10-14 01:18:49 UTC, end at Fri 2016-10-14 16:18:25 UTC. –我可以按预期查看该范围内的日志。 我的问题是为什么我不能用journalctl查看较早的日志,我该如何解决这个问题,以便查看日志?
我曾经可以编辑/ etc / sysconfig / clock,但现在我需要使用timedatectl,我相信这是一个systemd命令。 这与启动系统有什么关系?
我在编写一个简单守护进程的单元文件时遇到了这个问题。 当守护进程在启动时返回“1”时,systemd会忽略它,看起来守护进程已成功启动,而实际上已经死了。 例如,我有非常简单的shell脚本: #!/bin/bash exit 1 所以单元文件看起来像这样: [Unit] Description=test service After=syslog.target [Service] User=testuser Group=testuser ExecStart=/usr/local/bin/return1 [Install] WantedBy=multi-user.target 试着开始,似乎没问题: # service testservice start # echo $? 0 但实际上它已经死了 # service testservice status ● testservice.service – test service Loaded: loaded (/etc/systemd/system/testservice.service; enabled) Active: failed (Result: exit-code) since Fri 2016-01-22 14:51:45 MSK; 1min 13s ago Process: 16416 ExecStart=/usr/local/bin/return1 […]
我有Debian Jessie并通过ssh连接到它。 我想通过systemd在用户login时自动启动shell命令。 我创build了一个简单的systemd服务~/.config/systemd/user/foo.service巫婆包含: [Unit] Description=Systemd autostart test Wants=local-fs.target After=local-fs.target [Service] Type=oneshot ExecStart=/bin/sh -c "echo 123 >> /home/user/there;" [Install] WantedBy=multi-user.target 我已经通过systemctl启用它 systemctl –user enable foo 我已经创build了成功的消息容器 touch ~/there 并在重新启动和login(通过SSH) ~/there文件是空的。 当我手动使用它 systemctl –user restart foo 有用。 我错过了什么?
假设我有这样的shell脚本: #!/bin/sh # cherrypy_server.sh PROCESSES=10 THREADS=1 # threads per process BASE_PORT=3035 # the first port used # you need to make the PIDFILE dir and insure it has the right permissions PIDFILE="/var/run/cherrypy/myproject.pid" WORKDIR=`dirname "$0"` cd "$WORKDIR" cp_start_proc() { N=$1 P=$(( $BASE_PORT + $N – 1 )) ./manage.py runcpserver daemonize=1 port=$P pidfile="$PIDFILE-$N" threads=$THREADS request_queue_size=0 verbose=0 } […]
我有一个Python脚本,我通常使用这个命令来运行它: (environment) python run.py 我想在开始时运行这个脚本。 (我正在使用Ubuntu)这是我的服务: [Unit] Description=My Script Service After=multi-user.target [Service] Type=idle ExecStart=/home/user/anaconda3/bin/python /home/user/space/run.py [Install] WantedBy=multi-user.target 顺便说一句,我不能运行这个脚本,但我可以运行任何脚本不在内部环境。 如何在启动时运行python脚本(virtualenv)? sudo systemctl status user_sent ● user_sent.service – Mail Service Loaded: loaded (/lib/systemd/system/user_sent.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since xxxxx 16:30:20 MSK; 3s ago Process: 3713 ExecStart=/usr/bin/python run.py (code=exited, status=200/CHDIR) Main PID: 3713 (code=exited, […]
nginx不会在启动时启动,但可以手动启动。 日志说的是类似的东西 nginx: [emerg] host not found in upstream "{some hostname}" in /etc/nginx/conf.d/some_site.conf nginx: configuration file /etc/nginx/nginx.conf test failed Failed to start A high performance web server and a reverse proxy server. nginx.service: Unit entered failed state. nginx.service: Failed with result 'exit-code'. 看来,在启动DNS还没有准备好,Nginx正在尝试查找我作为反向代理的主机名。