Mac System Plugin - v2.0.1

bip.philippe
Posts: 58
Joined: Wed Feb 20, 2013 2:09 am
Location: France

Mac System Plugin - v2.0.1

Post by bip.philippe »

Mac System plugin : Indigo Automation (v6+ ) Plug-In for managing Disk Volumes and Applications

Introduction

This plug-in allows to declare as devices : disk volumes and applications.

For disk volumes :
  • allows to mount/unmount volumes,
  • has an option to force unmount,
  • prevent sleeping (option) of volumes,
For Application :
  • launch/quit application,
  • Imagecan close the application window to do a kind of "silent" launch,
  • has an option to force quit application
ImageHelpers and Daemon devices are special kind of application devices.

Typical use of this plugin is managing an iTunes instance as a media server, on the same mac than the Indigo server. The kind of scenarios I use are :
  • Turn on the media service :
    1. When the house wakes up, a trigger turns on the raid disk (using a reay device)
    2. When the disk volume is mounted (i.e. disk volume device becomes on), a trigger launches iTunes by setting the Application device to On
    3. Then you can use iTunes Plug-in or Airfoil plugin as usual
  • Turn off the media service :
    1. When the house goes to sleep, a trigger sets the application device to off to stop iTunes,
    2. When iTunes device is off, a trigger unmount the disk volume (i.e. sets disk volume device to off),
    3. When the disk volume is off, then the raid drive relay device is set off.
This project is managed on Github : https://github.com/bipphilippe/Indigo-D ... Mac-System


Plugin setup

Release history and latest version are here : https://github.com/bipphilippe/Indigo-D ... m/releases .

The plug-in configuration contains only elements for debug purpose.

Image


Application device

This type of device is mainly dedicated to usual MacOS X applications, i.e.: softwares with a .app extension, mainly installed in the Applications folder.

Configuration
To create a device looking for an Application, create a new device of Type "Mac System" and Model "Application".

The name used in this screen does not need to be the name of the application.

Image

The basic device settings allow you to define :
  • The name of the application without the .app extension; this name is case sensitve.
  • Image Close window after launch without stopping the application (using a standard applescript script).
  • "Force quit" if you want the application to be forces quit when the device is set to off by the user. Force quit allow to prevent the application staying open because of an opened dialog box but will close the application without saving data.
The extended device settings allow you to deal with special cases (not needed for classical Mac application in the application folder):
  • Image "Use special path" if your application is not in the application directory.
  • Image "Use special process name" if the process name created by the application is not the same that the name of the application.
  • Image "Use special special windows close command if you want to use another applescript that the basic one to close the application window after launch.
Image

States
The device has the following states :
  • On/Off: according if the application is running or not
  • Process ID: Id of the mac OS process running the application
  • Process Status: a value between :
    • Idle : process that is sleeping for longer than about 20 seconds (reflected by a "paused" status icon)
    • Running : process that is running or sleeping for less than about 20 seconds
    • Stopped : stopped process (reflected by a "stopped" status icon)
    • Waiting : process in uninterruptible wait (reflected by a "paused" status icon)
    • Zombie : dead process (a ``zombie'') (reflected by a "red circle" status icon)
    • Off : no process running
  • Last start time
  • Elapsed running time
  • Percentage CPU usage
  • Percentage memory usage

Action
The device has the following Action :
  • Image"Close application window" that allows to call the script defined to close the application windows.

Helper device Image

This type of device is mainly dedicated to helper applications. These applications are often launched when you open your session. They are not located in the Applications folder but behave in some way as an application. You can start and stop them using the device if needed.

Configuration
To create a device looking for an Application, create a new device of Type "Mac System" and Model "Helper Application".

The name used in this screen does not need to be the name of the helper application.

Image

The device settings screen allows you to define :
  • The helper Application Name, without .app extension.
  • The helper application directory path. This path is not the standard Application directory. It is something more complex that I will explain hereafter.
Image

In the majority of the Application Helpers, these ones are launched during user session opening. The list of the helpers can be seen in the Mac system preferences called "users and group".
On the "Login Items" tab, you can see a list of items.
Some of them are Application Helpers.
If you find the one that you are looking for, just right-click on it and select "Reveal in finder".
This will open a finder window, with the Helper Application selected.
The name of the application is to be keyboarded in the device configuration " Helper Name" item.
The path to the directory that has been open is to be keyboarded in the device configuration " Helper directory path" item.

Image

A sticky note in this forum is tracking log of all the Helper configuration that I tried or that users gently signaled to me : http://forums.indigodomo.com/viewtopic. ... 62&t=14182.

States
The device has the same states that the Application device.

Action
The device has no Action defined.

Daemon device Image

This type of device is mainly dedicated to daemon processes. These processes are often launched when you open your session. They are not located in the Applications folder and do not behave as an application. You can stop them using the device but it is not guaranteed that you can start them.

Configuration
To create a device looking for an Application, create a new device of Type "Mac System" and Model "Daemon".

The name used in this screen does not need to be the system name of the daemon.

Image

The device settings screen allows you to define :
  • The daemon process name.
  • The daemon full path and name, that will be used to start or stop the daemon using the two following parameters.
  • The deamon start command arguments. They are used to ask to the daemon manager to start it. It allows the "On" command of the device to work.
  • The deamon stop command arguments. They are used to ask to the daemon manager to gently stop it. Leaving it empty will do a forced quit on "Off" command.
Image

A sticky note in this forum is tracking log of all the daemon configuration that I tried or that users gently signaled to me : http://forums.indigodomo.com/viewtopic. ... 62&t=14182.

States
The device has the same states that the Application device.

Action
The device has no Action defined.

Disk volume device

Configuration
To create a device looking for a disk volume, create a new device of Type "Mac System" and Model "Disk Volume".

The name used in this screen does not need to be the name of the volume.
Image

The device settings allow you to define :
  • The name of the volume ; this name is case sensitve.
  • Check "Force unmount" if you want the application to be forced unmount when the device is set to off by the user. Force quit allow to prevent the volume staying mounted because of an opened file but will unmount without saving data.
  • Check "Keep awaken" if you want the disk to say awake even if your Mac preferences are set to make the disks to sleep. I use it for my RAID drive as it is too slow to wake up, allowing the other drive going to sleep as usual.
Image

States
The device has the following states :
  • On/Off : according if the volume is mounted or not
  • Volume type: type of the file system
  • Volume size: size of the volume
  • Volume device: system device hosting the volume
  • Volume Status: one value between these ones :
    • On: the volume is mounted and available
    • Not mounted: the disk is powered on but the volume in not mounted (reflected by a "stopped" status icon)
    • Off: the disk is powered off (or not plugged in)
  • Last awake ping time: last time a waking up signal has been sent to the volume by the plug-in (when "Keep awaken" option is on)
  • Used percentage: % of disk used
bip.philippe
Posts: 58
Joined: Wed Feb 20, 2013 2:09 am
Location: France

v1.1.0 release note

Post by bip.philippe »

Note : if you are updating from a previous version of the plugin, please edit the configuration of each of your application or volume device just after update.

Manages new states for devices :
  • enhanced use of ps command to collect more information
  • use of df command to collect % used
Introduces special state icons to reflect some special states :
  • volume connected but not mounted
  • application frozen or waiting
Optimization :
  • updates detailed volume an application data in a slower pace than the onOff state
Some bugs corrections, including :
  • library error when launching some application
  • keep alive timing too close to sleep to prevent some kind of disks to sleep
Note : this version now uses a framework common to my plugins.
bip.philippe
Posts: 58
Joined: Wed Feb 20, 2013 2:09 am
Location: France

v1.1.1 release note

Post by bip.philippe »

Bug corrections:
  • update requests are now processed
  • ps dump process is now more permissive on data positions
  • avoid sending Turn On when device already On
  • avoid sending Turn Off when device already Off
bip.philippe
Posts: 58
Joined: Wed Feb 20, 2013 2:09 am
Location: France

v1.2.0 release note

Post by bip.philippe »

Enhancements:
  • add a "about" menu
  • new log management, less verbose
  • manages the "Enable Indigo Communication" flag
bip.philippe
Posts: 58
Joined: Wed Feb 20, 2013 2:09 am
Location: France

v1.2.1 release note

Post by bip.philippe »

Some bugs corrections, including:
  • library error when closing some application
bip.philippe
Posts: 58
Joined: Wed Feb 20, 2013 2:09 am
Location: France

v1.2.2 release note

Post by bip.philippe »

Some bugs corrections, including:
- Error on volume with special characters as '
bip.philippe
Posts: 58
Joined: Wed Feb 20, 2013 2:09 am
Location: France

v2.0.0 release note

Post by bip.philippe »

Special application types release
Enhancements:
  • new devices: Helpers and Daemons
  • new action: close application windows
  • new turn-on property: auto-close application windows
  • auto-add of missing device parameters and states when upgrading
  • better respect of properties and states data types
Some bugs corrections, including:
  • Applescript library error filter
  • error message after install
bip.philippe
Posts: 58
Joined: Wed Feb 20, 2013 2:09 am
Location: France

v2.0.1 release note

Post by bip.philippe »

Some bugs corrections, including:
  • daemon start argument is not mandatory
  • daemon search in ps command is more accurate
Locked

Return to “Bip's Plugins”