Run Script on Startup with Raspbian Jessi Wheezy and Raspberry Pi2B

Run Script on Startup with Raspbian Jessi Wheezy and Raspberry Pi2b

I suggest to follow this
http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/custom-boot-up-screen.
It works for me and it's easy.
Hope it helps

Start Raspberry Pi without login

Raspbian Wheezy:

Following was taken from eLinux.org RPi Debian Auto Login page:

Auto Login:

In Terminal:

sudo nano /etc/inittab

Scroll down to:

1:2345:respawn:/sbin/getty 115200 tty1

and change to

#1:2345:respawn:/sbin/getty 115200 tty1

Under that line add:

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

Ctrl+X to exit, Y to save followed by enter twice

Auto StartX (Run LXDE):

In Terminal:

sudo nano /etc/rc.local

Scroll to the bottom and add the following above exit 0:

su -l pi -c startx

Raspbian Jessie:

Use raspi-config. If, for some magic reason this tool is not present on your system, install it:

sudo apt-get install raspi-config

Hard way:

Link. Link.


UPDATE 2019.05

In recent distro there's a simpler way to fix this:

At command prompt, type sudo raspi-config, then:

  • select option 3 in menu (Boot Options)
  • select option B1 (Desktopp/CLI)
  • select option B2 (Console Autologin)

Hit OK, exit all the way and restart.

Update 2019.05 credit belongs to Hasan A Yousef.

Run a script after Bluetooth is configured and running - Rasperry Pi 3

The new init system for Debian 8 "Jessie" is systemd. The old way in Debian 7 "Wheezy" was Sysv with runlevels and /etc/inittab. A drawback of using crontab to run your program will be, if the script execution crashes, it dies forever. Restarting a script automatically if its ends is called "respawn".

As you can see, the Bluetooth Service is running and prints that a "Target" is reached. To create your own service, which runs after bluetooth startup, and respawns with systemd just create a file in /etc/systemd/system/ i.e. my_program.service

[Unit]
Desription=my_program with systemd, respawn, after bluetooth
After=bluetooth.target

[Service]
ExecStart=node /home/pi/workspace/my_program
Restart=always

[Install]
WantedBy=multi-user.target

and activate it

systemctl enable my_program.service

reboot or start it manually

systemctl daemon-reload
systemctl start my_program.service

If one kills the process or reboots, my_program will be restarted automatically some seconds later.

Start Raspberry Pi without login

Raspbian Wheezy:

Following was taken from eLinux.org RPi Debian Auto Login page:

Auto Login:

In Terminal:

sudo nano /etc/inittab

Scroll down to:

1:2345:respawn:/sbin/getty 115200 tty1

and change to

#1:2345:respawn:/sbin/getty 115200 tty1

Under that line add:

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

Ctrl+X to exit, Y to save followed by enter twice

Auto StartX (Run LXDE):

In Terminal:

sudo nano /etc/rc.local

Scroll to the bottom and add the following above exit 0:

su -l pi -c startx

Raspbian Jessie:

Use raspi-config. If, for some magic reason this tool is not present on your system, install it:

sudo apt-get install raspi-config

Hard way:

Link. Link.


UPDATE 2019.05

In recent distro there's a simpler way to fix this:

At command prompt, type sudo raspi-config, then:

  • select option 3 in menu (Boot Options)
  • select option B1 (Desktopp/CLI)
  • select option B2 (Console Autologin)

Hit OK, exit all the way and restart.

Update 2019.05 credit belongs to Hasan A Yousef.

Are command line commands the same between Raspbian and Ubuntu Desktop?

On such a generic level, the answer has to be "no" - simply because the two different OS have potentially different versions of certain packages, different architectures for e.g. startup-scripts, and also a different set of services running etc....

So depending on what you do, you will have to adapt to the new OS.

Of course limited to the scope of certain commands, the answer could be yes.

Raspberry pi 3 wireless error

ifup and ifdown are in the debian package named ifupdown.

sudo apt-get install ifupdown


Related Topics



Leave a reply



Submit