Search code examples
bashsshstartupbeagleboneblack

Running code without ssh in beaglebone black


I want to run some code in Beaglebone black without doing ssh when I apply power.

I have tried putting some commands to run the code in ~/.bashrc file but it only works when I login using ssh. I have tried same thing with /etc/rc.local file but didn't work even after ssh.

I have also tried @reboot my_command in crontab -e but it also requires me to login using ssh Any suggestions??

EDIT:

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

Output of crontab -e: last few lines

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 is the script I want to run


Solution

  • crontab -e method worked!!. My script required two overlays to execute the code which I didn't load that's why my @reboot command didn't work. I solved my problem by adding required overlays.

    @reboot config-pin overlay cape-universaln
    @reboot config-pin overlay BB-ADC
    @reboot /root/wiringBone-master/library/main
    

    And now my code works on reboot.