The purpose of this add-on is to perform tasks on startup for each container, within the context of that container. Tasks such as mounting folders, pinging REST APIs, starting servers, and other such tasks may be performed by scripts.
Installation
Within Home Assistant, click Supervisor-> Add-on Store → … button (in top left)-> Repositories. Add this repository.
Click Run On Startup.d and then install.
Within the Info screen, Disable the “Protection Mode”.
Scripts
Scripts for each container may be placed in the home assistant configuration folder, usually /config/startup/startup.d/name-of-container.sh. These scripts will be executed in order from last container started to first.
You can find the name of your container in the Add-On logs, or from a terminal execute docker container ls
, or you can create a template script for each container by setting the “Create example scripts in /config/startup/startup.d” to true.
Here is an example of my startup.d folder, as viewed with Samba.
Logs
Logs may be found in the home assistant configuration folder, usually /config/startup/logs/name-of-container.log. Depending on configuration options, listed below, your logs may persist forever or be replaced on each startup.
Configuration
Setting name | Valid Values | Description |
---|---|---|
Seconds to wait before startup scripts execute | 1-999999 | Provides a delay from the time this container starts until the time it will begin executing commands in other containers. |
Create example scripts in /config/startup/startup.d | lowercase true/false | If true, a script for all running containers will be created in the /config/startup/startup.d folder. Each created script will display the environmental variables for the container. |
Retain old logs in /config/startup/logs/ instead of deleting old logs | lowercase true/false | If true, logs will be appended. Otherwise, logs will be replaced on each startup. |
Use Cases
- Mount a folder to a specific container during startup
- Modify DNS settings for a container
- Start a script without the overhead of a whole container
- Quickly create and reuse existing scripts
- Run command line apps without a specific container
At you own risk
This can be dangerous. Please be sure you understand what you are doing.
This allows you to break all rules and security models of docker containers and Home Assistant. Because your scripts will run as root and you are given the capability of destroying your machine, this addon achieves the highest insecurity rating of 1. Standard sudo warnings all-around: respect, think, with great power comes great responsibility and never type rm -rf /
. Never.
Useful Stuff
Pease post your scripts for others.
Mount a folder to your Home Assistant
Modify System DNS entries