Beaglebone BlackでSSHなしでコードを実行する

Beaglebone BlackでSSHなしでコードを実行する

Beaglebone black何もせずに電源を入れたときにいくつかのコードを実行したいと思います。ssh

~/.bashrcファイルにコードを実行するためにいくつかのコマンドを入れてみましたがssh/etc/rc.local

私も試してみましたが、@reboot my_command SSHcrontab -eを使用してログインする必要があります。

どんな提案がありますか? ?

編集する:

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私が実行したいスクリプトです

root@beaglebone:~# systemctl enable cronie.service
Failed to execute operation: No such file or directory

ライセンスと所有者main

root@beaglebone:~/wiringBone-master/library# ll main 
-rwxr-xr-x 1 root root 66744 May 27 16:15 main

ベストアンサー1

crontabが解決策です。呼び出し方法:

crontab -e

これでデフォルトエディタが開きます。次に追加:

@reboot your command

保存と終了。コマンドにスーパーユーザーパスワードが必要な場合は、まずrootとしてsudo su -ログインする必要がありますcrontab -e

問題の原因(cronまたはスクリプト)を見つけるには、デバッグ目的でより簡単なケースを作成できます。

  • @reboot date >> /root/aまず、cronジョブの後に類似または類似の行を追加します。crontab -e
  • 動作している場合(〜ファイル「/root/a」に日付/時刻を追加)、その行は同じ所有権と権限()を使用してbashスクリプトに保存されます。-rwxr-xr-x 1 root root例:

    #!/usr/bin/sh
    date >> /root/a
    

おすすめ記事