I would like to execute a program automatically,when power supply at ON.


I made TCP client program for Beaglebone Black on Angstrom Linux.

I would like to execute a program automatically,when power supply at ON for connection to server.

I put the execute file here.


I made a file called myScript.sh on this pass.


It is contents of file myScript.sh


I executed the following command for file myScript.sh.

chmod u=+rwx myScript.sh

Next, in /etc/rc5.d folder、I executed the command.

ln -s ../init.d/myScript.sh S99myScript

I thought that it can start in this automatically,

but I can’t.

I refer to these contents.


Would you tell me any your advice thing or solution?



You can put myScript.sh into the /etc/profile.d directory and your script will be executed on startup.

Obviously there’s several ways to do this, but that’s cheap and cheerful.



Hi Anthony,

Thank you for your reply.

I was able to do it.

Thank you so much.

Kenji Maehara

2014年4月24日木曜日 21時01分36秒 UTC+9 cove...@gmail.com:

Hello Anthony, it looks like that this method only works if I boot up and ssh to the BBB OS. Do you know of a method that would allow a program to execute once there is power through the BBB (with 5V port not the USB)?

I have been trying to figure this out for a while now. I would really appreciate it if you can provide me with some suggestions on this matter.
Thanks in advance,


If you’re using Debian Wheezy, the instructions below are taken from my blog and work. More information here: https://wiki.debian.org/LSBInitScripts

Create some file, and edit it accordingly. In my case test

touch /etc/init.d/test && nano /etc/init.d/test

And in the file we put . . .

#! /bin/sh

# Provides: test
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Short script description
# Description: Longer script description.
case “$1″ in
/sbin/route add default gw dev eth0
/usr/sbin/ntpdate pool.ntp.org

exit 0

Then we must make the file executable, so we issue the command:

chmod +x /etc/init.d/test

Followed by the new method of installing the service. Do note the first command tests the file, and the second command actually installs the file as a service.

insserv -n /etc/init.d/test
insserv /etc/init.d/test

NOTE this method knows nothing about when your board has power applied. This servicewill however start every time Debian is booted up. Even from a soft boot / restart.

I like using crontab.

use “crontab -e” to edit the cron file and insert a line with something like:

@reboot pathToMyScript