Execute script during boot-up before Docker starts

  • Good Morning,


    I have script at /usr/local/bin/permissions.sh
    with the following lines in it:


    I think it should be clear what it does. The tv card and the card reader need permissions for the user "Docker" because all docker are running not as root.


    So far so good. The problem is, after every reboot I need to stop "Oscam" and "Tvheadend" Docker, execute this command and restart the dockers. Not that bad, because my machine is usually running 24/7, but sometimes i want to restart it und just need it automated.



    How and where can I atomate this during startup before docker starts?


    UDEV?


    Crontab?



    What do you guys recommend and how.



    Thanks

    • Offizieller Beitrag

    How and where can I atomate this during startup before docker starts?

    Use a system unit override file (systemctl edit docker.service) to add


    [Service]
    ExecStartPre=/usr/local/bin/permissions.sh


    then systemctl daemon-reload

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Offizieller Beitrag

    Please do not override the service file itself, systemd has a feature to add custom options. Please use google how to do that.

    That is exactly what the commands I gave do. systemctl edit SERVICE.service will create an overrides file in /etc/systemd.system.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Use a system unit override file (systemctl edit docker.service) to add
    [Service]
    ExecStartPre=/usr/local/bin/permissions.sh


    then systemctl daemon-reload

    Just rebooted... works perfecttly. Thanks.


    After saving the file I relaized the filename was


    Is it relevant what name this file has, or can I rename it because the folder where it is safed is relevant?!

    • Offizieller Beitrag

    Is it relevant what name this file has, or can I rename it because the folder where it is safed is relevant?!

    It can be renamed as long as it stays in the same folder.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!