unifi-utilities / unifios-utilities

A collection of enhancements for UnifiOS based devices
GNU General Public License v3.0
3.93k stars 419 forks source link

Scripts do not seem to run after a reboot #327

Open slafc94 opened 2 years ago

slafc94 commented 2 years ago

Describe the bug It seems like the scripts inside of /mnt/data/on_boot.d do not run after my UDM-Pro is rebooted. The scripts are all executable (-rwxr-xr-x) and have the correct format (.sh and #!/bin/sh). An example script is below:

01-Cron-BT.sh

!/bin/sh

FILE=/etc/cron.d/bt CONTENTS=" * /bin/sh /mnt/data/on_boot.d/10-BT.sh>/dev/null 2>&1" if [ -f "$FILE" ]; then echo "$FILE exists." else echo "$FILE does not exist. Creating..." echo "$CONTENTS" >> $FILE fi /etc/init.d/S90dcron restart

and 10-BT.sh:

!/bin/sh

if [ "$(/sbin/ip addr show eth8 | /bin/grep -cim1 '10.20.30.1')" -ge 1 ]; then

echo 'Fake IP on eth8 Exists!'

    :

else echo "Adding Fake IP to eth8" /sbin/ip addr add 10.20.30.1 dev eth8 fi

Expected behavior I'd expect the cronjob file to be created which it isn't until I manually run the script

UDM Information

jhspyhard commented 2 years ago

Seeing the same thing here after a reinstall / upgrade of udm-utilities v1.0.5, on a UDM Pro v1.11.0.

I have been on UDMP v1.11.0 for a bit and my scripts WERE being run after reboot. However, I had re-run the udm-utilities force install / upgrade command. The install script output implied I had v1.0.5 previously, but I didn't recognize the 06-cni-bridge.sh or 05-install-cni-plugins.sh scripts that got installed into /mnt/data/on_boot.d - those scripts weren't there before. So I have no idea what version I was on previously.

After the upgrade of udm-utilities, now none of my scripts seem to be executing on boot-up anymore either.

EDIT: I reinstalled via unifi-os shell and afterwards noticed that my systemctl status udm-boot was not reporting the service unit set to enabled. Running systemctl enable udm-boot fixed my issue.

campmeharder commented 2 years ago

Seeing the same thing here after a reinstall / upgrade of udm-utilities v1.0.5, on a UDM Pro v1.11.0.

I have been on UDMP v1.11.0 for a bit and my scripts WERE being run after reboot. However, I had re-run the udm-utilities force install / upgrade command. The install script output implied I had v1.0.5 previously, but I didn't recognize the 06-cni-bridge.sh or 05-install-cni-plugins.sh scripts that got installed into /mnt/data/on_boot.d - those scripts weren't there before. So I have no idea what version I was on previously.

After the upgrade of udm-utilities, now none of my scripts seem to be executing on boot-up anymore either.

EDIT: I reinstalled via unifi-os shell and afterwards noticed that my systemctl status udm-boot was not reporting the service unit set to enabled. Running systemctl enable udm-boot fixed my issue.

was having issues with my udm not starting pihole on reboot, and tried your solution and didnt work for me, using 1.11.0 as well but udm.

docbobo commented 2 years ago

I think you should check if the files under /mnt/data have an .sh extension...

AndrewDaws commented 2 years ago

EDIT: I reinstalled via unifi-os shell and afterwards noticed that my systemctl status udm-boot was not reporting the service unit set to enabled. Running systemctl enable udm-boot fixed my issue.

I just ran into this exact same issue systemctl enable udm-boot was the solution. This really should be fixed, since I don't recall this being an issue anytime before.

sc994 commented 2 years ago

Seeing the same thing here after a reinstall / upgrade of udm-utilities v1.0.5, on a UDM Pro v1.11.0.

I have been on UDMP v1.11.0 for a bit and my scripts WERE being run after reboot. However, I had re-run the udm-utilities force install / upgrade command. The install script output implied I had v1.0.5 previously, but I didn't recognize the 06-cni-bridge.sh or 05-install-cni-plugins.sh scripts that got installed into /mnt/data/on_boot.d - those scripts weren't there before. So I have no idea what version I was on previously.

After the upgrade of udm-utilities, now none of my scripts seem to be executing on boot-up anymore either.

EDIT: I reinstalled via unifi-os shell and afterwards noticed that my systemctl status udm-boot was not reporting the service unit set to enabled. Running systemctl enable udm-boot fixed my issue.

Also seeing the same behaviours, systemctl enable udm-boot was the fix

mdemerson commented 2 years ago

EDIT: I reinstalled via unifi-os shell and afterwards noticed that my systemctl status udm-boot was not reporting the service unit set to enabled. Running systemctl enable udm-boot fixed my issue.

Another win using systemctl enable udm-boot, thank you <3

dehness commented 2 years ago

EDIT: I reinstalled via unifi-os shell and afterwards noticed that my systemctl status udm-boot was not reporting the service unit set to enabled. Running systemctl enable udm-boot fixed my issue.

Another win using systemctl enable udm-boot, thank you <3

Same here. Much love @jhspyhard

digitalface commented 2 years ago

Yep, udm-boot wasn't enabled. Thanks for the tip @campmeharder

ArmandH commented 2 years ago

wow this really needs to be fixed why do i with luck have to find this in the reported issues and its not in any wiki info?

gatesry commented 2 years ago

@ArmandH Feel free to add your notes and fixes to the Wiki. See https://github.com/boostchicken-dev/udm-utilities/blob/master/CONTRIBUTING.md for more info.

logock commented 2 years ago

The remote_install.sh script didn't work for me either setting up a fresh UDM on 1.12.22. Same issue as above, udm-boot was not set to enabled. Performing the "manual install" incl. systemctl enable udm-boot fixed the issue.

Unlearned6688 commented 2 years ago

UDM Pro. I had to enable this as well. Follow instructions for manual install.

I saw my Adguard for UDM wasn’t accessible or pingable.

checked the script run on boot status- it was disabled (the install is supposed to enable it)

did the manual install (you have to do go into the shell too, don’t skip that step)

use the enable command in the instructions

check the status now. It’s enabled (yay)

Reboot device and double check