App Termination
Key name: AppTermination
Element type: Dictionnary
Status: Optional
Holds the keys to customize the app termination behavior.
This group is optional. It can be omitted. In this case, the classic shortcut to quit the app will be enabled, and no script will be executed when the app terminates.
Keys
Name | Type | Required |
---|---|---|
QuitShortcutIsEnabled | Boolean | 1.0.0-2.0.6: Required |
ForceQuitShortcutIsEnabled | Boolean | |
ForceQuitShortcutKey | String | |
IncompleteInstallationScriptPath | String | 1.0.0-2.0.6: Required |
CompleteInstallationScriptPath | String | 1.0.0-2.0.6: Required |
WaitForTerminationScriptExecution | Boolean | |
ExecuteAsRoot | Boolean | |
RelaunchAtLogin | Boolean |
Detail
QuitShortcutIsEnabled
Type: Boolean
Default: true
Explanation: If set to true
, the classic ⌘Q is enabled to let the user quit the app. Otherwise, the shortcut is ⌃⌘⌥Q.
1.0.0-2.0.6: Required
ForceQuitShortcutIsEnabled
Type: Boolean
Explanation: If set to true
, this shortcut enables to terminate the application unconditionally. Default is true
. The shortcut is ⇧⌃⌥⌘F. The letter can be modified with the ForceQuitShortcutKey
key.
ForceQuitShortcutKey
Type: String
Explanation: The letter to use with the modifier keys to force the application termination. Default is "F".
Make sure to avoid conflicts with already existing shortcuts.
IncompleteInstallationScriptPath
Type: String
Explanation: A path to a script to execute when Octory terminates. The installation is complete if all the application and file monitors are installed. If the installation is incomplete, the script specified at this path will be executed. You can leave it with a stub value if you have no script to execute.
1.0.0-2.0.6: Required
The execution of a script when the app terminates has been proved unstable. If you face a difficulty when executing a script, or if it is not properly executed, please consider using the provided Helper with the key ExecuteAsRoot
as explained below.
CompleteInstallationScriptPath
Type: String
Explanation: A path to a script to execute when Octory terminates. The installation is complete if all the application and file monitors are installed. If the installation is complete, the script specified at this path will be executed. You can leave it with a stub value if you have no script to execute.
1.0.0-2.0.6: Required
WaitForTerminationScriptExecution
Type: Boolean
Explanation: If set to true
, the application will wait until termination script is completed (either success of failure), and its output will be printed out in the application log file. Otherwise if set to false
or no value provided, the application will only wait for the script to be launched and then the app will terminate. The script will continue to run but its output will be included in the app log file only if it finishes before the application.
ExecuteAsRoot
Type: Boolean
Explanation: If set to true
, the application will ask the Helper to execute the script with root privileges. Thus, this will require to have the Helper installed. Default is false
.
In the page Manage Octory Helper, an explanation is given to install this Helper.
The following commands in a script allow you to restart and shutdown the computer, while not requiring the root rights:
- restart:
osascript -e 'tell app "System Events" to restart'
- shutdown:
osascript -e 'tell application "Finder" to shut down'
For Octory2.0.2
, you can simply writereboot
as the application will use the Helper with root privileges to execute the termination script.
Thus, you can use these commands at the end of the scripts to be executed when the application terminates. This solution - rather than doing it in Octory internally - ensures that your scripts will be executed to the end, before the computer restart or shutdown..
RelaunchAtLogin
Type: Boolean
Default: true
Availability: 2.1.0+
Explanation: When true
, the application will be launched at the next login if it was running when the system was turned off or restarted.
Example
The following configuration for the app termination disables the classic quit shortcut ⌘Q. Also, it will execute a script when the app terminates depending on the installation states of the monitors. Note the usage of the placeholder OCTORY_DIRECTORY
which is the App directory.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>AppTermination</key>
<dict>
<key>QuitShortcutIsEnabled</key>
<false/>
<key>IncompleteInstallationScriptPath</key>
<string>${OCTORY_DIRECTORY}/Scripts/incompleteFinish.sh</string>
<key>CompleteInstallationScriptPath</key>
<string>${OCTORY_DIRECTORY}/Scripts/completeFinish.sh</string>
</dict>
<!-- ... -->
</dict>
</plist>