Brigadoon - An Occasional Corner on the Internet
Sky Camera Timing Software
Designed by Mark Little
The first task required for the sky camera is a means by which update the sky camera images on a regular basis. For simplicity, this example will assume that the image from the camera is to be updated every five (5) minutes.

Fortunately, the Operating System provides a program that can be used to schedule the execution of programs on a regular basis. Although there are many variants of this program, this example will use the standard version, known as "cron". Is it beyond the scope of this example to explain "cron" in detail, so it will focus on how to set up cron the run a task every five minutes.

"cron" gets its tasking from a file called "crontab" that specifies commands to be run periodically at a given schedule. It should be noted that each account (including root) has its own crontab file that is normally subject to the same privileges as the account.

To look at the current contents of the crontab file, enter the following command at the prompt "crontab -l". The entries in the files, if they exist will have the following format:
By way of a simple example, if the objective is to run a program "/sbin/" at 08:05pm on every day of the week, the crontab file would have the following line inserted:

05 20 * * * /usr/local/sbin/

Looking at the table above, the first number is the minutes of the hour (05), the second is the hour of the day in 24-hour format (20 being 8pm). The next star means any day of the month, followed by any month of the year and any day of the week. The last entry is the program to be run So, decoding this line, the program "/sbin/" will be run every day at 08:05pm.

To run the task every five minutes, the crontab line would be altered as follows:

00,05,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/sbin/

The list of minutes separated by the commas means that the program will be run every five (5) minutes (as each entry is five (5) minutes apart). This will now happen for every hour, since the hours value has been changed to a "*" which means every hour of the day. There many more options that are available in the crontab file, but explaining them is out of scope for this project. More information can be found by issuing the command "man crontab" at the Raspberry Pi command line or using it as a Google- search.

To put this command into your crontab file, the first thing to do is to set the editor that crontab will use. If you do not do this, you may have difficulty controlling the editor. For example, if you wish to use the editor "nano" for editing the crontab file, enter this command line ("nano" must already be installed on the machine):

export VISUAL=nano; crontab -e

enter the command "crontab -e" and enter the crontab line above at the end of the file and exit, saving the file. You can check the entry afterwards by repeating the "crontab -l" command. The crontab editor can be changed permanently by adding "export VISUAL=nano" to the "$HOME/.bashrc" file. A description of this activity is beyond the scope of this project.

Although there is currently no program called "", you have just set up what will eventually cause the sky image to be read, scaled and uploaded every five (5) minutes.
Raspberry Pi Sky Camera
IP Sky Camera