运行 beaglebone black 中没有 ssh 的代码
Running code without ssh in beaglebone black
我想在 Beaglebone black 中 运行 一些代码,而不是在我通电时执行 ssh。
我尝试将一些命令放入 运行 ~/.bashrc
文件中的代码,但它仅在我使用 ssh
登录时有效。我用 /etc/rc.local
文件尝试过同样的事情,但即使在 ssh 之后也没有工作。
我也在 crontab -e
中尝试过 @reboot my_command
但它也需要我使用 ssh 登录
有什么建议吗??
编辑:
root@beaglebone:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
root@beaglebone:~# ps aux | grep cron | grep -v grep
root 295 0.0 0.3 4428 1988 ? Ss 15:03 0:00 /usr/sbin/cron -f
crontab -e
的输出:最后几行
root@beaglebone:~# crontab -e
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
#@reboot /root/wiringBone-master/library/main not working
#*/5 * * * * /root/wiringBone-master/library/main works
main
是我要的脚本运行
我对 beagle bone 一无所知,但在普通的 Linux 系统上,您可能会使用 init 脚本或更容易地在设置为 运行 在启动时。
您必须检查您的环境是否支持其中任何一个。即使它没有 cron,它也可能 运行 正在执行某种初始化(可能是在启动时启动 SSH,但 YMMV)。
/etc/rc.local
是一种快捷方式。确保启动到后台并且不要阻止脚本完成。
写一个合适的 systemd 服务文件会更好。
crontab -e
方法奏效了!!我的脚本需要两个覆盖层来执行我没有加载的代码,这就是我的 @reboot command
不起作用的原因。我通过添加所需的叠加层解决了我的问题。
@reboot config-pin overlay cape-universaln
@reboot config-pin overlay BB-ADC
@reboot /root/wiringBone-master/library/main
现在我的代码在重启时可以正常工作。
我想在 Beaglebone black 中 运行 一些代码,而不是在我通电时执行 ssh。
我尝试将一些命令放入 运行 ~/.bashrc
文件中的代码,但它仅在我使用 ssh
登录时有效。我用 /etc/rc.local
文件尝试过同样的事情,但即使在 ssh 之后也没有工作。
我也在 crontab -e
中尝试过 @reboot my_command
但它也需要我使用 ssh 登录
有什么建议吗??
编辑:
root@beaglebone:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
root@beaglebone:~# ps aux | grep cron | grep -v grep
root 295 0.0 0.3 4428 1988 ? Ss 15:03 0:00 /usr/sbin/cron -f
crontab -e
的输出:最后几行
root@beaglebone:~# crontab -e
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
#@reboot /root/wiringBone-master/library/main not working
#*/5 * * * * /root/wiringBone-master/library/main works
main
是我要的脚本运行
我对 beagle bone 一无所知,但在普通的 Linux 系统上,您可能会使用 init 脚本或更容易地在设置为 运行 在启动时。
您必须检查您的环境是否支持其中任何一个。即使它没有 cron,它也可能 运行 正在执行某种初始化(可能是在启动时启动 SSH,但 YMMV)。
/etc/rc.local
是一种快捷方式。确保启动到后台并且不要阻止脚本完成。
写一个合适的 systemd 服务文件会更好。
crontab -e
方法奏效了!!我的脚本需要两个覆盖层来执行我没有加载的代码,这就是我的 @reboot command
不起作用的原因。我通过添加所需的叠加层解决了我的问题。
@reboot config-pin overlay cape-universaln
@reboot config-pin overlay BB-ADC
@reboot /root/wiringBone-master/library/main
现在我的代码在重启时可以正常工作。