[Boot] Excute Script On Boot

This is the exploration of procedures to automatically launch a script everytime raspberry boots up with power cycle.

View and control local tty(x) from network

> sudo apt-get install linuxvnc
> sudo linuxvnc (numerical tty number)

Auto-login for ttys

Create symlink at

/etc/systemd/system/getty.target.wants/getty@tty(x).service

to

/etc/systemd/system/autologin@.service

Manual starting of extra ttys

$ systemctl start getty@ttyN.service

Script Launching on tty(x)

Adding scripts under ~/.profile:

# ~/.profile: executed by the command interpreter for login shells.

if [[ $(tty) = /dev/tty2 ]]; then
 echo Welcome! Using tty2 to run tau2 camera v4l2 driver...
 ./tau2_14bit_run/01firev4l2loopback.sh
fi

if [[ $(tty) = /dev/tty3 ]]; then
 echo Welcome! Using tty3 to run gstreamer 14-bit image capture...
 ./tau2_14bit_run/02gst-script-raw.sh
fi

 


Read more about .profile file:
http://dghubble.com/blog/posts/.bashprofile-.profile-and-.bashrc-conventions/

On a clean install of Ubuntu, you’ll notice your home directory contains both a .profile and .bashrc file. Starting a login shell executes .profile and starting a non-login shell executes .bashrc.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s