unifios-utilities/on-boot-script/README.old.md
bruvv 162d4ce478
Auto set correct data path (#491)
* Corrected file path by removing /mnt

* Update 20-zerotier.sh

* Update README.md

* removed /mnt directory as evertyhing is done in /data

* Corrected URL

* Update remote_install.sh

* Auto check data dir

* fixed adguard installation

* More data fixes

* Fix dns common data path

* fixed haproxy readme
2023-02-22 08:49:54 -08:00

1.7 KiB

Legacy setup

Automated Setup

  • NB! THESE WILL NOT PERSIST THROUGH FIRMWARE. They still work however
  1. Copy install.sh to your UDM and execute it
  2. Copy any shell scripts you want to run to /data/on_boot.d and make sure they are executable and have the correct shebang (#!/bin/sh) Examples:

Manual Setup

  1. Copy on_boot.sh and make on_boot.d and add scripts to on_boot.d

    mkdir -p /data/on_boot.d
    vi /data/on_boot.sh
    chmod u+x /data/on_boot.sh
    

    Example: on_boot.sh

  2. Enter the container shell

    unifi-os shell
    
  3. make a script that sshs to the udm and runs on our boot script. 127.0.1.1 always points to the UDM

    echo "#!/bin/sh
    ssh -o StrictHostKeyChecking=no root@127.0.1.1 '/data/on_boot.sh'" > /etc/init.d/udm.sh
    chmod u+x /etc/init.d/udm.sh
    

    Example: udm.sh

  4. make a service that runs on startup, after we have networking

    echo "[Unit]
    Description=Run On Startup UDM
    After=network.target
    
    [Service]
    ExecStart=/etc/init.d/udm.sh
    
    [Install]
    WantedBy=multi-user.target" > /etc/systemd/system/udmboot.service
    

    Example: udmboot.service

  5. enable it and test

    systemctl enable --now udmboot
    
  6. back to the udm

    exit
    
  7. reboot your udm/udmpro and make sure it worked

    reboot
    exit