Start Script

Start Script Details

A template Start script is provided in the custom app template tarball. The Start script is responsible for starting and stopping the application.

  • Required to exist at the top level of the application tarball
  • It must accept the following command line arguments: start, stop, restart, and reload.
  • The provided template shows how to use start-stop-daemon to start and stop your app, but this script can be fully customized to use whatever start/stop mechanism you wish.
  • Apps will be automatically started after install and on boot and stopped on shutdown.
  • This script is always run as root. Don’t forget to make the permissions on the Install script executable by the appropriate user.

The below process flows show exactly when and how the Start script is executed.

Install Process

  1. app-manager launched to install a custom app either from a DeviceHQ® command or manually from the command line
  2. If a version of the app is already installed, app-manager executes the Start script with the stop argument
  3. app-manager installs the app via the Install script
  4. app-manager executes the Start script with the start argument
  5. The Conduit® checks into DeviceHQ to report new Installed Apps information

Uninstall Process

  1. app-manager launched to uninstall a custom app
  2. app-manager executes the Start script with the stop argument
  3. app-manager uninstalls the app via the Install script.
  4. The Conduit checks into DeviceHQ to report new Installed Apps information

Boot Process

  1. Conduit starts boot process
  2. The /etc/init.d/customapp init script is executed with priority 95
  3. customapp queries app-manager for all installed apps
  4. For each app, customapp launches app-manager to start it
  5. app-manager executes the Start script with the start --initd arguments

Shutdown Process

  1. Conduit shutdown initiated
  2. The /etc/init.d/customapp init script is executed with priority 95
  3. customapp queries app-manager for all installed apps
  4. For each app, customapp launches app-manager to stop it
    app-manager executes the Start script with the stop --initd arguments

Config Install Process

  1. app-manager launched to install an app config from a scheduled DeviceHQ action
  2. app-manager downloads the new config file and places it in the config/ directory, overwriting any existing files.
  3. app-manager executes the Start script with the reload argument