【发布时间】:2019-10-22 07:50:39
【问题描述】:
我想将myScript.sh 设置为自动启动。
我已经设置好了配置。
chmod +x /etc/init.d/myScript.sh
并启用它
sudo update-rc.d /etc/init.d/myScript.sh defaults
但是当我运行myScript.sh 时,由于标志-bootRun 而出现错误。 myScript.sh 看起来像这样:
sudo /home/pi/path/to/my/program/gradlew -bootRun
我怎样才能运行这个脚本呢?
编辑:
我听下面那个人的。我将代码放在 Raspberry 中的 rc.local /etc。
但是当我运行时,我得到了这个错误。为什么?
【问题讨论】:
-
您的初始化脚本丢失了很多。将其与同一目录中的其他文件进行比较。也许您更愿意查找how to run a command on boot?
-
@thatotherguy 我只是按照这个“手册”raspberrypi.stackexchange.com/questions/15475/…
-
这样做的问题是,它在处理不能快速退出的命令时效果不佳,并且在您关闭时会重新运行命令等等。查看more upvoted 对同一问题的回答。
-
@thatotherguy 好的!我会试试的:)
-
@thatotherguy 现在查看我更新的问题。
标签: linux shell raspberry-pi gradlew autostart