FrontierStack User Manual Manual home
Desktop Manual Mobile Manual 日本語 frontierstack.app ↗

Part IV

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.

12

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).

screenshot to be added
Figure 12.1. The Scripts & Cron pane: the saved-script library on top, with Run / Schedule / Edit buttons, and the cron jobs below.Capture: capture: open Scripts & Cron with three or four saved scripts visible and one or two cron jobs listed
The Scripts palette
Toggle Palette next to any script to add it to the floating Scripts palette — a small, always-on-top window of just your palette-tagged scripts, each with a Run button. Keep it beside your editor and pop it open any time. Press Open Palette in the pane to summon it.

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).

WarningA scheduled cron job runs automatically, without further approval. Unlike an interactive script or an AI tool call — which show you an approval card before anything happens — once a job is on the schedule, it fires on its own, every time, unattended. Schedule only commands you have tested and trust, and review the Cron Jobs list periodically so nothing keeps running that you have forgotten about.

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.

Script triggers
Below the script library, Script Triggers run a saved script when an event happens rather than at a clock time — you arrive at or leave a location, a device appears or disappears on the network, or a disk mounts or unmounts. These fire only while the app is running, and the script receives context (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.

ScriptWhat it does
apache_real_docrootDiscovers the document root a vhost is actually serving — not what the config claims, but what Apache resolves at run time.
apache_url_matrixReports 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_diffCompares one file's checksum across your fleet to find configuration drift — where a machine has quietly diverged from the rest.
macos_httpd_vhostsDumps the macOS Server backend's vhost → docroot map, so you can see exactly what that legacy stack is serving.
macos_web_restartRestarts the macOS Server web backend the right way — the correct sequence, not a blunt apachectl.
node_healthcheckA fleet drift / health check for one vhost across nodes.
php_opcache_checkReports 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:

ActionWhat it doesBuilt-in Siri phrase
Run Server ScriptRuns one of your saved scripts by name.
Start / Stop Service GroupStarts or stops every service in your group at once.“Start my servers with FrontierStack”
Restart ServiceRestarts Apache, Nginx, MySQL or PostgreSQL.“Restart a service with FrontierStack”
Restart Docker ContainerRestarts a named container.
Get Local HealthReturns the Local Health summary (services up / down).“Check server health with FrontierStack”
Apply Sidebar PresetSwitches the sidebar to a saved preset.
Flush DNS CacheFlushes the macOS DNS resolver cache.
Send NotificationSends a notification through your alert channels.
Ask Server AssistantSends 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.

TipPrefer voice? With the built-in phrases you can simply say “Check server health with FrontierStack”, “Start my servers with FrontierStack” or “Ask FrontierStack…” from any Apple device signed into your iCloud and your stack answers, hands-free.

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.

NotePause something for a window with two actions, not one. To pause a service between 2am and 5am, schedule a stop action at 2am and a start action at 5am. App actions are point-in-time triggers, so a window is simply its two edges.
WarningScheduled app actions perform real changes — reboots, service stops — on their schedule with no approval prompt at the moment they fire, exactly like cron. They require “Allow changes” to have been enabled when created. Review the Scheduled App Actions list the same way you review your crontab.

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.

NoteAuto-export runs while the app is open and checks roughly every few minutes, exporting any feed whose interval has come due. Like app actions, it is an in-app schedule, so pair it with a Mac that stays awake (Chapter 17 covers keeping a headless Mac from sleeping) if you need it to run around the clock.

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