Part IV
Automation & AI
Scripts and schedules, the AI Administrator, MCP, and the AI stack — the four chapters that turn FrontierStack from a control panel into something that works on its own.
Chapter 12
Scripts, Cron & Automation
Save the commands you run all day, schedule them on real system cron, and wire FrontierStack into Apple Shortcuts, Siri and the rest of your Mac — from a one-click script to a hands-free voice command.
A good server administrator does the same handful of things over and over: run a backup, warm a cache, restart a backend the right way, check a vhost is actually serving what you think. FrontierStack lets you capture each of those as a saved script, run it with one click, and — when you trust it — hand it to cron so it runs unattended. From there it reaches outward, into Apple Shortcuts, Siri, the frontierstack:// URL scheme and scheduled actions the app performs on its own.
This chapter covers the mechanical side of automation: scripts, schedules and the macOS automation surfaces. The intelligent side — an AI that writes, saves and schedules these scripts for you — is Chapter 13. Everything here is something the AI Administrator can drive through its own audited tools, so the two chapters describe the same machinery from two ends.
12.1The Scripts & Cron pane
Open Scripts & Cron from the sidebar. It is your saved-script library and your scheduler in one place. The Saved Scripts section at the top lists every script you have kept, each with its name and the first line of its body. For each one you get four buttons: Run (execute it now), Schedule (hand it to cron, below), Edit (open the editor), and a trash icon to delete it. Press Add Script… to write a new one.
A saved script is a genuine executable file on disk — shell, PHP or Python — not a fragment the app interprets. Give it a clear name and a note describing its purpose, so that six months later (or the AI Administrator, scanning your library) can tell at a glance what it does and pick the right one. Because the saved file is exactly what runs, what you test by hand is exactly what runs on a schedule.
Each script can target This Mac by default, a local Docker container, or a linked server over SSH by name. Where a script needs a credential, it references a named secret from the local .env vault as an environment variable ($DB_PASSWORD, "$SSH_SUDO_PASS"); the app injects the real value at run time and never lets it reach a cloud model (Chapter 13).
12.2Scheduling with cron
The Cron Jobs section is a friendly front-end onto your real system crontab — not a separate scheduler the app invents, but the same cron that has run unattended work on Unix for decades. Each row shows a job's name, a plain-English description of its schedule (FrontierStack translates the five-field syntax for you), and the command it runs, with a switch to enable or disable it and buttons to Run it now, Edit it, or delete it.
Press Schedule on a saved script, or Add Job… for an arbitrary command, to open the schedule builder. Pick a cadence — hourly, daily at a time, weekly — and FrontierStack writes the crontab entry, tagging its own jobs with a # AC: comment so it can find and update them by name later. The same applies through the AI Administrator: list_cron reads your jobs, and schedule_cron creates or updates one (updating in place if a job of that name already exists).
For full control, expand Edit raw crontab at the bottom of the pane. This is the standard crontab in a text editor; FrontierStack-managed jobs appear as # AC: comments so you can see which lines it owns. Edit by hand and press Apply.
FS_TRIGGER, FS_LOCATION, FS_DEVICE, FS_DISK…) as environment variables. Cron handles time; triggers handle events.12.3The bundled sample scripts
FrontierStack ships a small read-only library of proven, battle-tested admin scripts. They are not your scripts — you cannot edit them in place — but you can read any one's full source, learn from it, and copy it into your own library to adapt. They encode real-world quirks of a Mac web stack (especially the old macOS Server backend), so reading one before writing your own saves you the surprises. The AI Administrator reads them first too, via list_sample_scripts and read_sample_script, so its scripts inherit the same hard-won knowledge.
| Script | What it does |
|---|---|
apache_real_docroot | Discovers the document root a vhost is actually serving — not what the config claims, but what Apache resolves at run time. |
apache_url_matrix | Reports the HTTP status for a list of paths on a vhost, tested over the real host header, so you can see at a glance which URLs are healthy. |
fleet_file_diff | Compares one file's checksum across your fleet to find configuration drift — where a machine has quietly diverged from the rest. |
macos_httpd_vhosts | Dumps the macOS Server backend's vhost → docroot map, so you can see exactly what that legacy stack is serving. |
macos_web_restart | Restarts the macOS Server web backend the right way — the correct sequence, not a blunt apachectl. |
node_healthcheck | A fleet drift / health check for one vhost across nodes. |
php_opcache_check | Reports OPcache status for both the CLI and the web SAPI, which are configured separately and easy to get out of step. |
12.4Apple Shortcuts, App Intents & Siri
FrontierStack ships native App Intents — actions that appear in the macOS Shortcuts app, in Spotlight, and (for several of them) as built-in Siri phrases you can speak. Drop them into a Shortcut you trigger from a hotkey, the menu bar or a Folder Action; they work from Automator too, since Automator can run Shortcuts and AppleScript. The shipped actions:
| Action | What it does | Built-in Siri phrase |
|---|---|---|
| Run Server Script | Runs one of your saved scripts by name. | — |
| Start / Stop Service Group | Starts or stops every service in your group at once. | “Start my servers with FrontierStack” |
| Restart Service | Restarts Apache, Nginx, MySQL or PostgreSQL. | “Restart a service with FrontierStack” |
| Restart Docker Container | Restarts a named container. | — |
| Get Local Health | Returns the Local Health summary (services up / down). | “Check server health with FrontierStack” |
| Apply Sidebar Preset | Switches the sidebar to a saved preset. | — |
| Flush DNS Cache | Flushes the macOS DNS resolver cache. | — |
| Send Notification | Sends a notification through your alert channels. | — |
| Ask Server Assistant | Sends a plain-English question to the AI Administrator and returns the answer into your workflow. | “Ask FrontierStack…” |
The catalogue is wider still — Get Server Status, List Servers, List Docker Containers, Check a Website and more are all available to build Shortcuts with, even where they carry no stock Siri phrase.
12.5Driving the app from a script
Because the App Intents are real Shortcuts actions, you can call them from a shell step with the macOS shortcuts command-line tool — useful inside a saved script, a cron job, an Automator “Run Shell Script” action or any launcher. Wrap a FrontierStack action in a one-line Shortcut, then invoke it with shortcuts run "My Shortcut", chaining it with anything else your script does.
The AI Administrator can do this assembly for you. Ask it for an automation script that drives the app through Shortcuts and it calls list_app_intents to see the available actions and the exact shortcuts run invocation for each, then authors the script with save_script (or schedules it with schedule_cron). You get a finished, runnable script rather than a hint.
12.6Scheduled app actions
A cron job runs a shell command. A scheduled app action is different: it is a task the app itself performs on a schedule, using its stored credentials and the same audited tools you and the AI Administrator use — not a raw shell command. Use an app action to reboot a linked server, start, stop or restart a local service the app controls, or flush DNS on a timetable. They are managed through schedule_app_action and listed by list_app_actions, and they appear under Scheduled App Actions in the pane. The natural way to create one is to ask the AI Administrator — “reboot web-03 every night at 3am” — and approve it.
There is one important difference from cron: an app action only runs while FrontierStack is open. It performs the action through the app, so it catches nothing that falls due while the app is closed. Cron, by contrast, runs at the system level whether the app is open or not. Choose cron for things that must happen no matter what, and app actions for things the app must do with its own credentials and tools.
12.7The frontierstack:// URL scheme
Every pane, server, site, container and Cloudflare zone has a frontierstack:// deep link. From AppleScript, an Automator shell step, a launcher or any script runner, a single line such as open frontierstack://pane/Security brings the app forward and jumps straight to that pane. It is the fastest way to wire FrontierStack into an existing workflow when you want the app on screen at a particular place rather than running an action headless. The complete URL-scheme reference is in Chapter 18.
12.8Auto-export of backups, logs and the change-log
The last piece of routine automation is getting FrontierStack's own generated files off the Mac on a schedule. In the Backups overview, the Auto-export to a folder section copies generated artefacts to any folder you choose — a Dropbox folder for off-site safety, or a folder watched by Hazel to drive your own downstream rules. Three feeds are built in:
- Settings backup — a zip of your configuration backups.
- Change-log — the running record of changes made through the app.
- App logs — a zip of FrontierStack's own logs.
For each feed you set an interval (hourly, 6-hourly, 12-hourly, daily or weekly), pick the destination folder, and optionally turn on Empty after export to rotate the source after each copy (handy for the change-log and app logs, so they do not grow without bound). Export now runs a feed immediately, and each feed shows its last result. Files land as FrontierStack-<feed>-<timestamp> in your chosen folder.
You now have the full mechanical toolkit: scripts you save and run, cron and app actions that run them on a schedule, Shortcuts and Siri that trigger them by hotkey or voice, a URL scheme that jumps anywhere, and auto-export that ships the results off-box. The next chapter introduces the operator who can author and wire all of this for you — the AI Administrator.
FrontierStack User Manual · Version 1.0.0 · Chapter 12