- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
如何将由 systemd ExecStart 脚本运行的脚本输出重定向到引导控制台?
我需要在启动前调试脚本的问题,但我不能使用 journalctl,因为它是带有 ROM rootfs 的嵌入式 linux。
现在我的 .service 文件如下所示:
[Unit]
Description=Init script
After=network.target
Before=getty@tty1.service
[Service]
Type=oneshot
ExecStart=/usr/lib/systemd/test_init_script
ExecStartPre=/usr/bin/echo -e \033%G
ExecReload=/bin/kill -HUP $MAINPID
WorkingDirectory=/
Enviroment=TERM=xterm
[Install]
WantedBy=multi-user.target
测试初始化脚本:
#!/bin/sh -
echo "Test!"
它没有用,启动后我收到消息:
#systemctl status test_init_script.service
test_init_script.service - Init script
Loaded: loaded (/usr/lib/systemd/test_init_script.service)
Active: failed (Result: exit-code) Since Thu 1970-01-01 08:26:03 CST; 19s ago
Process: 170 ExecStartOre=/usr/bin/echo -e -G (code=exited, status=203/EXEC)
有人知道如何将脚本输出重定向到终端吗?
最佳答案
好的,所以我通过使用更改的文件构建图像来解决这个问题:
/etc/journald.conf
我将存储选项更改为 volatile 的地方:
Storage=volatile
此选项意味着所有日志数据都将存储在 RAM 中,因此这是只读文件系统的解决方法。
请参阅journald 手册页以查看更多选项。
关于linux - 将 systemd 脚本输出重定向到控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28580081/
我想在 systemd 的 myapp.service 文件中使用多个命令 [Unit] Description=to serve myapp [Service] User=ubuntu Workin
我想为 systemd 服务启用核心转储生成,该服务提供 SEGV 状态并退出。 scd.service: main process exited, code=killed, status=11/SE
我有一个由 systemd 运行的程序,其服务文件如下所示: [Unit] Description=... [Service] Type=notify ExecStart=/usr/sbin/mypr
我有一个 systemd 单元,参数中有空格 ExecStart=command --argument="text text" systemd 似乎无法识别双引号或单引号,并将参数拆分为两个参数。知道
我正在使用一个 systemd 服务,它在“启动”时调用一个进程(例如 systemctl start test.service)。根据设计,进程永远处于循环状态,我们可以使用 ps 命令查看进程的存
我的解决方案(到目前为止)是从公共(public) session 中评论 pam_systemd.so 。一切都在 system.slice 中运行,没有对照组。我还不确定这会产生什么影响,但至少一
我四处查看并用 google 搜索,找不到节点导出器公开的 systemd 指标列表? 最佳答案 node_systemd 指标列表: node_systemd_unit_state - System
我正在尝试将文件写入磁盘作为 ExecStartPre 的一部分systemd 单元文件的命令。 这就是我正在使用的: [Unit] Description=My service [Service]
我的 journalctl到处都是gnome-session警告。我已将问题追溯到谷歌浏览器,警告相对无害。然而,它淹没了我的日志输出,坦率地说,如果我确实需要检查它,我将无法找到我需要的东西。 Ma
操作系统级别:CentOS Linux release 7.4.1708普罗米修斯等级:2.4.2prometheus.service: [Unit] Description=Prometheus [
我们有一个 systemd 服务,根据建议的配置 here 来管理 Puma 进程。 . 虽然看起来运行良好,但重新启动超时,因此看起来失败,即使它们是成功的。如何调试这一类问题? systemd 期
systemd 可以让 rsyslog 守护进程保持事件状态,即使它死了,这真是太棒了。 但是我正在制作一个新的 rsyslog 配置文件,并且需要在 Debug模式下启动此 rsyslog 守护进程
我想更改 systemd-logind 服务的环境参数。这不在 configuration.nix 中可用的登录选项中,所以我尝试了 systemd = { services.system
我试图了解我的新项目中不同 systemd 服务之间的依赖关系。我们正在使用 yocto 构建系统和 systemd/系统服务。 如果我表现出色, systemctl -l 它将按字母顺序列出所有服务
我正在尝试在 lindux debian 上安装和配置 systemD,但在安装 systemd-sysv 时出现错误,我知道这是让 systemD 管理服务所必需的。 当我运行时 apt-get i
我有两个服务 A 和 B。 A 在启动时在 etcd 中设置一个值,比如它从环境文件中获取的公共(public) IP 地址: ExecStartPost=/usr/bin/etcdctl set /
我们目前在一台主机上运行着许多不同的服务,我们正在广泛使用 systemd,包括用于消息传递的 systemd-notify 和用于服务管理的自己的前端。 我们希望开始在容器内运行这些服务,以简化依赖
我们目前在一台主机上运行着许多不同的服务,我们正在广泛使用 systemd,包括用于消息传递的 systemd-notify 和用于服务管理的自己的前端。 我们希望开始在容器内运行这些服务,以简化依赖
几个月前,我使用 systemd.journal 编写了一个小型 Python 服务。 Pip list 显示我在相应的 virtualenv 中安装了 python-systemd (231)。 当
我想启动一个不存在的计时器,它应该在当时启动一个不存在的服务。这应该通过 systemd 临时单元(如 systemd-run)来完成。 当我执行以下代码时,我收到一个异常(见下文)。有人可以告诉我,
我是一名优秀的程序员,十分优秀!