π System Startup
MOS provides dedicated hooks that are executed during system startup. These hooks allow controlled customization of the boot process.
π Mounted Script (mounted.sh)β
The Mounted Script is executed after all storage is mounted but before services are started.
It runs after disks, Samba, NFS, and iSCSI are mounted/connected and before Docker, LXC, VM, and other services are started. This makes it suitable for tasks that need storage to be available but should run before services start.
π Script Locationβ
/boot/optional/scripts/mounted.sh
If this file exists, MOS will automatically execute it during every system boot.
β±οΈ Execution Orderβ
The Mounted Script is executed in the following phase:
- Storage pools are mounted
- Samba, NFS, and iSCSI connections are established
- Mounted Script is executed
- Docker, LXC, VMs, and system services are started
At this stage, all storage is available but services have not started yet.
π§ Typical Use Casesβ
- Running scripts that depend on mounted storage pools
- Preparing data directories before services start
- Syncing configuration files from mounted storage
- Running health checks on storage before services start
- Setting up network shares before services access them
π§ Recommended Usageβ
While MOS provides startup scripts for early system customization, it is strongly recommended to use Cron jobs whenever possible.
Cron jobs:
- Run in a fully initialized system environment
- Are easier to manage and debug
- Reduce the risk of boot-time failures
- Are suitable for most automation tasks
Startup scripts should only be used when actions must run after storage is mounted but before services start.
π Script Execution Notesβ
- Startup scripts do not need to be executable
- No
chmod +xis required - Script execution is handled internally by MOS
As long as the script file exists at the correct path, MOS will execute it automatically.
β οΈ Important Notesβ
- Storage pools are available at this stage
- Services are not running yet
- Logging and output are limited
- Errors in this script can affect service startup
Use this script carefully and keep it as minimal as possible.
Parts of this documentation were created with the assistance of AI tools. All AI-generated content has undergone review, but it may still contain inaccuracies, omissions, or outdated information.