8000 OnDemand · macadmins/outset Wiki · GitHub
[go: up one dir, main page]

Skip to content
Bart Reardon edited this page Mar 7, 2023 · 10 revisions

Running Scripts On Demand

Usage

Your on-demand script(s) will only run in the current user console (GUI) session. If you are using Fast User Switching, on-demand scripts will not run in any background user sessions.

on-demand scripts will not run if the Mac is at the login window.

At the completion of an on-demand run, Outset will delete everything from /usr/local/outset/on-demand/ so these scripts will not be invoked during any subsequent user logins.

But What If I Want To...??

If the desired effect is to trigger an on-demand script that will immediately be invoked for any currently logged-in user, and you also want it to run as a login-once script for any subsequent logins, then you have a few options.

First, you can install the script into both /usr/local/outset/on-demand/ and /usr/local/outset/login-once/ and trigger the on-demand run with the packaging method above. This will run the script immediately and, the next time anyone logs in, will run the script in the login-once context.

However, this presents a certain dilemma: your script will effectively run twice for current user; once now, and once when they login again. This may not be the desired behavior.

To help with this, there is another built-in option to Outset. There are two additional arguments that can be passed:

/usr/local/outset/outset --login-once
/usr/local/outset/outset --login-every

Include your script(s) in the respective /usr/local/outset/login-once/ or /usr/local/outset/login-every/ directory, and place a script in /usr/local/outset/on-demand/ that calls one or both of the above commands, it will loop through and process the scripts in the expected context.

This means, if your script was added to /usr/local/outset/login-once/ and you run the --login-once argument in your on demand script, then Outset will treat it like any other login-once item by processing it and logging it in the preference file so that subsequent logins won't run this script again.

Since on-demand scripts run in the context of the currently logged in user, you cannot process boot-once or boot-every scripts in this way as those require root privileges.

Triggering On-Demand Runs Manually

One can also trigger On-Demand runs via a touch to a specific file or by using a specific flag. This may be helpful for situations like running an On-Demand script via Apple Remote Desktop. Running an On-Demand script runs as the user.

  • Touch the Watch File via:

/usr/bin/touch /private/tmp/.io.macadmins.outset.ondemand.launchd

  • Run the Outset On-Demand Flag:

/usr/local/outset/outset --on-demand

0