【问题标题】:Run a shell command automatically and directly after restarting and keep it running重启后自动直接运行shell命令并保持运行
【发布时间】:2018-05-03 11:10:41
【问题描述】:

我有这个shell命令asebamedulla "ser:device=/dev/ttyACM0",我希望它在重启Linux后直接运行。 我阅读了一些解决方案(shell_command &,或者在后台作为守护进程运行......)但我不知道如何使用它们。 我的问题是:
如何在启动后直接自动运行 shell 命令?

【问题讨论】:

  • 试一试主管:immortal.run/post/run.yml
  • 我只是把它放在 .bashrc 中,如下:command & 让它在后台运行,一切正常。

标签: linux shell command startup


【解决方案1】:

解决方案 1:

>>sudo crontab -e

#In the first line of this file enter this:

@reboot <your command whatever>

#Save and Exit

解决方案 2:

将脚本命名为 “whatever.sh”

将文件放在您的 /etc/init.d/ 目录中。

更改文件的权限。

chmod +x /etc/init.d/whatever.sh

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-05
    • 1970-01-01
    • 2018-05-01
    • 2016-08-26
    • 1970-01-01
    • 2018-06-11
    • 1970-01-01
    • 2012-07-27
    相关资源
    最近更新 更多