After a hasty trip to Fry’s in Anaheim last night, I managed to cobble together a prototype power supply that powers both the monitor and the Raspberry Pi from a single source! Now I just need to clean it up and stuff it all inside a nice frame!

Sometimes, you need a task to run at a particular time on a particular schedule. For Project Spoofy, I need the Raspberry Pi to reboot periodically so that any new photos added to ownCloud will be subsequently added to the fbi slideshow. For simplicity, I’m going to schedule a task in Linux to reboot the Pi each night at about 2:30AM, so no one should be affected by the short break in the slideshow.

Schedule a task in Linux

To schedule a task in Linux, use the cron utility to define the schedule as well as the command to be executed. Cron has to be edited by the root account, so a standard user (pi) would need to execute the following command:

cron -e -u root

If logged in as root already, simply execute cron -e

Debian will ask which utility to use to edit the crontab file; I prefer using nano as with everything else. Once the crontab file is open in nano, you will see some information as well as some example formatting. Basically, every task should exist on a separate line starting with the scheduling:
┌───────────── min (0 – 59)
│ ┌────────────── hour (0 – 23)
│ │ ┌─────────────── day of month (1 – 31)
│ │ │ ┌──────────────── month (1 – 12)
│ │ │ │ ┌───────────────── day of week (0 – 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
│ │ │ │ │
│ │ │ │ │* * * * * command to execute
To reboot at 2:30AM every day, the following line must be appended to the end of the file:

30 2 * * * /sbin/shutdown -r now

The biggest thing to remember is ensuring that the time and time zone are correct. As a pilot, I understand the importance of UTC (or Zulu) time for coordinating across time zones, so I prefer to keep my remote machines set to UTC and do the math accordingly!

For Project Spoofy, once we’re automatically logged into the Raspberry Pi, we need to execute the commands to run the DDNS update client and the slideshow. It’s a simple process to automatically run a linux command on boot in Debian: just add the command(s) to the end of the .bashrc file in the user’s home folder.

For Project Spoofy, I’m using fbi to pull photos from ownCloud and display them automatically on screen with no further input. In order to do this properly, the system must automatically login to Linux without a password. What’s more, I need the system to login as root so that fbi will have access to the proper folders to display images. Since we’re working on a Raspberry Pi, note that these instructions are specific to Debian and it’s derivatives.

Fbi (Frame Buffer Imageviewer, not that other FBI) is a great lightweight Linux slideshow viewer that’s executable from the command line. It’s super simple to install, too:

sudo apt-get install fbi

Fbi will take any file or folder you specify in the command and create a slideshow. All the parameters are specified in the command line, for example:

fbi -noverbose -a -u -t 180 /PATH/TO/PHOTOS/*.jpg

For Project Spoofy, I’m going to point the fbi path to the ownCloud installation, but there’s a hitch: ownCloud has strict permissions, so it can only be accessed by root. In order to run fbi, we’ll need to run it as root. We can’t do this through sudo, though, as that only elevates privileges of the current user (pi). We’ll have to enable the root account either by logging in or by invoking the sudo -i command.

For more information on the fbi application, check out the manpage here.

Adventitious Geekery and other distractions created or curated by Matthew "Atari" Eargle

Subscribe!

Subscribe via email!

In my opinion the trombone is the true head of that family of wind instruments which I have named the epic one. It possesses nobility and grandeur to the highest degree; it has all the serious and powerful tones of sublime musical poetry, from religious, calm and imposing accents to savage, orgiastic outbursts. Directed by the will of a master, the trombones can chant like a choir of priests, threaten, utter gloomy sighs, a mournful lament or a bright hymn of glory, they can break forth into awe-inspiring cries and awaken the dead or doom the living with their fearful voices.