0

New Guide: Running Programs Automatically on Your Tiny Computer

checklist

Just posted, a new guide in our introductory Linux series, this one on using the init system to automatically start stuff at boot:

For projects using a small GNU/Linux system, it’s often important that certain code always be running when the computer is on. You can always log in and start a script running by hand once you turn on the power, but this isn’t very reliable – after all, the power might flicker, or the system might crash for unrelated reasons.

As an example scenario, I have a Raspberry Pi system in charge of logging data from my mousetrap, and I’m about to go on a trip to another continent. The electricity where I live goes out now and then, and I’d like to make sure that my mouse-counting code comes back up on a reboot.

On an Arduino or similar device, the code you write usually just runs shortly after the power comes on, courtesy of a bit of software called a bootloader. Linux systems have these too, but what runs by default is the kernel, which in turn runs something known as an init system that’s in charge of starting all sorts of other software to provide important services.

First, we’ll check out SysV-style init on a Raspberry Pi 2. With roots dating back to early Unix systems, sysvinit was widely used on most Linux distributions until recently, and is still used by the version of Raspbian released in May of 2015, based on Debian Wheezy. It’s also similar to mechanisms still used by the BSD branch of the Unix family tree.

Next, we’ll look at systemd on a BeagleBone Black running Debian Wheezy with systemd. systemd is “a suite of basic building blocks for a Linux system”, recently adopted by most of the major distributions, including Debian Jessie (the current stable release of the project). Eventually, Raspbian will probably run systemd too.

This one just barely scratches the surface of a pretty convoluted topic, and might need extensive updates in future, but hopefully it’s enough to get you going for the simple case. Check it out and let us know what you think.screencast-2015-08-31-18:20:31


Make a robot friend with Adafruit’s CRICKIT – A Creative Robotics & Interactive Construction Kit. It’s an add-on to our popular Circuit Playground Express, FEATHER and other platforms to make and program robots with CircuitPython, MakeCode, and Arduino. Start controlling motors, servos, solenoids. You also get signal pins, capacitive touch sensors, a NeoPixel driver and amplified speaker output. It complements & extends your boards so you can still use all the goodies on the microcontroller, now you have a robotics playground as well.

Join 7,500+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython in 2018 – Python on Microcontrollers is here!

Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Follow Adafruit on Instagram for top secret new products, behinds the scenes and more https://www.instagram.com/adafruit/


Maker Business — Electronics manufacturing is a burger of complexity

Wearables — Battery wash cycle

Electronics — How to make your own magnetic field probe!

Biohacking — The State of DNA Analysis in Three Mindmaps

Python for Microcontrollers — Getting Started with Adafruit Circuit Playground Express

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



No Comments

No comments yet.

Sorry, the comment form is closed at this time.