不要在 Ubuntu 22.04.2 LTS 启动时运行脚本

问题描述 投票:0回答:1

我们手动启动 bash 脚本链——一切正常,即 bash 脚本中的所有互连都是正确的。 screen1

已经按照手册配置了自动启动:https://linuxhint.com/use-rc-local-on-ubuntu/

在 /etc 文件夹中创建 rc.local 文件 screen2

在 /etc/systemd/system 文件夹中创建 rc-local.service 文件 screen3

重启服务器后执行命令时: sudo systemctl 状态 rc-local.service screen4

运行htop命令时 screen5

屏幕调用的文件'Bot_music_demo.sh'的内容 screen6

在带有 gnome 自动启动的 Ubuntu 22.04.2 LTS 上不起作用 在具有 Xfce 自动启动功能的 Ubuntu 22.04.1 LTS 上工作

我已经尝试了很多 ubuntu 的自动运行指令

我不明白正在运行什么“sh”进程而不是在屏幕上调用的我的脚本。甚至没有任何错误。

我怎样才能解决这个问题或至少追根溯源?

linux bash ubuntu screen autorun
1个回答
0
投票

尝试使用 crontab 运行。在终端运行crontab -e

@reboot /path/to/your/script.sh

我没有带 X 的 ubuntu,所以我无法检查。 @reboot 将在系统启动时开始执行您的命令。

© www.soinside.com 2019 - 2024. All rights reserved.