... | ... | @@ -2,6 +2,7 @@ |
|
|
1. [What is the Command Line](#what-is-the-command-line)
|
|
|
1. [Why use the Command Line](#why-use-the-command-line)
|
|
|
1. [Resize images example](#resize-images-example)
|
|
|
1. [MagicMirror timed menu display example](#magicmirror-timed-menu-display-example)
|
|
|
1. [Roon timed zone playback example](#roon-timed-zone-playback-example)
|
|
|
1. [History](#history)
|
|
|
1. [Opening the Command Line](#opening-the-command-line)
|
... | ... | @@ -111,6 +112,59 @@ done |
|
|
echo "Successfully resized ${count} JPEG images in ${IMGDIR}"
|
|
|
```
|
|
|
|
|
|
### MagicMirror timed menu display example
|
|
|
Another example of command line automation, specific to the MirrorCommandLine
|
|
|
project, might be display of a menu on a restaurant bathroom mirror that has
|
|
|
been setup as a MagicMirror. The restaurant owner wants the bathroom mirror to
|
|
|
display the breakfast menu during morning hours, the lunch menu at midday, and
|
|
|
the dinner menu in the evening. Before and after business hours she just wants
|
|
|
the mirror to be a mirror.
|
|
|
|
|
|
This can be accomplished by a worker manually configuring the MagicMirror in each
|
|
|
of the bathrooms but again is prone to error, delays, and can be tedious. Let's
|
|
|
do it in the command line utilizing the Cron facility which enables commands to
|
|
|
be executed at specified times of day, specified days/weeks/months/years, and so on.
|
|
|
|
|
|
After installing the MirrorCommandLine package and configuring MagicMirror config
|
|
|
files for each of the menus to be displayed, a Cron job can be created that executes
|
|
|
the appropriate `mirror` command at the desired time of day on the desired days
|
|
|
of the week. The Crontab entries might look like:
|
|
|
|
|
|
```bash
|
|
|
# This is a file named menucrontab.in with cron job entries
|
|
|
# m h dom mon dow command
|
|
|
#
|
|
|
# Breakfast starts at 7am on weekdays
|
|
|
0 7 * * 1-5 /usr/local/bin/mirror breakfast
|
|
|
# Lunch starts at 11am on weekdays
|
|
|
0 11 * * 1-5 /usr/local/bin/mirror lunch
|
|
|
# Dinner starts at 4pm on weekdays
|
|
|
0 16 * * 1-5 /usr/local/bin/mirror dinner
|
|
|
# Closing time is 9pm on weekdays
|
|
|
0 21 * * 1-5 /usr/local/bin/mirror blank
|
|
|
# Breakfast starts at 8am on weekends
|
|
|
0 8 * * 0,6 /usr/local/bin/mirror breakfast
|
|
|
# Lunch starts at 1pm on weekends
|
|
|
0 13 * * 0,6 /usr/local/bin/mirror lunch
|
|
|
# Dinner starts at 5pm on weekends
|
|
|
0 17 * * 0,6 /usr/local/bin/mirror dinner
|
|
|
# Closing time is 11pm on weekends
|
|
|
0 23 * * 0,6 /usr/local/bin/mirror blank
|
|
|
```
|
|
|
Create the above crontab file and, on each of the MagicMirror systems in
|
|
|
the restaurant setup the cron job by executing, as the user with MagicMirror
|
|
|
administration privileges, the command:
|
|
|
|
|
|
`crontab menucrontab.in`
|
|
|
|
|
|
Verify the cron jobs are setup properly with:
|
|
|
|
|
|
`crontab -l`
|
|
|
|
|
|
No 4 times daily tasks prone to error need be performed. Changing the
|
|
|
menu or the schedule of menu display will be a one-time task performed in a
|
|
|
few minutes by the MagicMirror administrator.
|
|
|
|
|
|
### Roon timed zone playback example
|
|
|
There are many many uses of the command line in automation. Another example,
|
|
|
specific to the RoonCommandLine project, might be the playback of specified
|
... | ... | @@ -157,7 +211,7 @@ Verify the cron jobs are setup properly with: |
|
|
|
|
|
`crontab -l`
|
|
|
|
|
|
Viola! No daily tasks prone to error need be performed in order to have
|
|
|
No daily tasks prone to error need be performed in order to have
|
|
|
automated zone specific playlists start and stop at designated times of day.
|
|
|
Changing the playlist or the schedule of playback will be a one-time task
|
|
|
performed in a few minutes by the Roon administrator.
|
... | ... | |
... | ... | |