✔️🏃Run On Startup.d

Hey guyz,
if somebody have working script for frigate, please let me know. I go sleep now. Was trying different ways which didn’t work for 4hours and then the author of this addon came to my help. But its too late in night to try.
Thank you

Okayyyyy lets go reinstall/reboot :smiley:

21-04-22 23:16:33 ERROR (SyncWorker_4) [supervisor.docker] Can't create container from addon_1f3d020e_run_on_startup_addon: 409 Client Error for http+docker://localhost/v1.40/containers/create?name=addon_1f3d020e_run_on_startup_addon: Conflict ("Conflict. The container name "/addon_1f3d020e_run_on_startup_addon" is already in use by container "a41b8b17886fb668322833e7a57d96499faa7919305b58c6a119940670157b1a". You have to remove (or rename) that container to be able to reuse that name.")

I successfully installed frigate inside proxmox LXC container with mounted network share. If anybody need assistance, PM me,will help. Don’t want to further spam this thread.

Install issue:

Repository link: GitHub - adamoutler/HassOSConfigurator: A set of Add-Ons to configure HassOS For various platforms and development purposes.

https://github.com/adamoutler/HassOSConfigurator

returns “Invalid Add-on repository!”

Clearly I’m using the wrong URL. What is the correct link? Sorry for the novice question.

image

[Update: next day[2021-11-30]… this works. not sure why it didn’t work yesterday
https://github.com/adamoutler/HassOSConfigurator

image

All I want to do is access /etc/crontabs/root and start crond. Am I in the wrong place expecting Startup.d to help?

For now I manually start crond after every re-boot (mostly “maintenance” related re-boots).

Thanks!

I’m running HA in a qemu VM and I need to add some storage in the form of a qcow2 file to store frigate snapshot.
Qcow2 file is correctly mounted as /dev/sdb1 and I need to mount inside the frigate container but when the addon tries to execute addon_ccab4aaf_frigate.sh script i have this error:

exec: fatal: unable to exec /tmp/addon_ccab4aaf_frigate.startup.sh: No such file or directory
exec: fatal: unable to exec /tmp/addon_ccab4aaf_frigate.startup.sh: No such file or directory
exec: fatal: unable to exec /tmp/addon_ccab4aaf_frigate.startup.sh: No such file or directory
exec: fatal: unable to exec /tmp/addon_ccab4aaf_frigate.startup.sh: No such file or directory
exec: fatal: unable to exec /tmp/addon_ccab4aaf_frigate.startup.sh: No such file or directory
exec: fatal: unable to exec /tmp/addon_ccab4aaf_frigate.startup.sh: No such file or directory 

Someone can help me?

Hi, @adamoutler1
I have a motioneye adds-on in my hassio, and I tried to mount a usb stick to /media/usb-drive in script, but the log shows “mount: permission denied (are you root?)”

how to deal with this?

I only get errors… Can someone please give me some advices? Thank you

executing
#############################################################################
###############/config/startup/startup.d/addon_ccab4aaf_frigate.sh
###############Container: 6ad55af52dcb: tmp/addon_ccab4aaf_frigate.startup.sh
#############################################################################
chmod: cannot access '/tmp/addon_ccab4aaf_frigate.startup.sh': No such file or directory

exec: fatal: unable to exec /tmp/addon_ccab4aaf_frigate.startup.sh: No such file or directory

#############################################################################
###############/config/startup/startup.d/addon_a0d7b954_ssh.sh
###############Container: 5297df21dff7: tmp/addon_a0d7b954_ssh.startup.sh
#############################################################################
mount: permission denied (are you root?)

#############################################################################
###############/config/startup/startup.d/addon_core_samba.sh
###############Container: 471306e8e4c9: tmp/addon_core_samba.startup.sh
#############################################################################
mount: mounting /dev/sda1 on /media/hp-drive failed: Permission denied

Hmm, cannot get it to run with a fresh install, tried re-install, reboot etc etc:

s6-overlay-suexec: fatal: can only run as pid 1
2022-05-16 01:53:30 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/1f3d020e_run_on_startup_addon/stats - Container addon_1f3d020e_run_on_startup_addon is not running
2022-05-16 01:53:33 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/1f3d020e_run_on_startup_addon/stats - Container addon_1f3d020e_run_on_startup_addon is not running
2022-05-16 01:53:55 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/1f3d020e_run_on_startup_addon/stats - Container addon_1f3d020e_run_on_startup_addon is not running
2022-05-16 01:54:21 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/1f3d020e_run_on_startup_addon/stats - Container addon_1f3d020e_run_on_startup_addon is not running
2022-05-16 01:54:46 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/1f3d020e_run_on_startup_addon/stats - Container addon_1f3d020e_run_on_startup_addon is not running
2022-05-16 01:54:55 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/1f3d020e_run_on_startup_addon/stats - Container addon_1f3d020e_run_on_startup_addon is not running
2022-05-16 01:54:56 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/1f3d020e_run_on_startup_addon/stats - Container addon_1f3d020e_run_on_startup_addon is not running
2022-05-16 01:57:35 WARNING (MainThread) [homeassistant.components.hassio] Could not fetch stats for 1f3d020e_run_on_startup_addon: Container addon_1f3d020e_run_on_startup_addon is not running

Should be working now. I think I forgot to update the version when I turned off init.

I still having the same issue with frigate not starting the script:

exec: fatal: unable to exec /tmp/addon_ccab4aaf_frigate-fa-beta.startup.sh: No such file or directory

Current version of addon: 0.11a

Does it work for other containers? I used the “create scripts” option in setup, then ran it. I then removed all my tokens and this is the result from the Web UI. Pastebin

Well, sort of. Out of the box and with the example scripts script.d runs for most containers, at least the log appears to be ok for almost all of them. Frigate appears to be one that doesn’t, given that the log is completely empty whereas the others all return apparently to have run correctly.

Considering my script, I have the same exact one on containers for supervisor, homeassistant and frigate (mount command is confirmed to be working outside the script):

#! /bin/bash

# mount CCTV for frigate
mkdir -p /media/cctv
mount -t cifs -o vers=2.1,noserverino,username=USERNAME,password=PASSWORD,domain=HOME.lan //192.168.18.1/share/frigate/ /media/frigate

# mount VIDEO
mkdir -p /media/video
mount -t cifs -o vers=2.1,noserverino,username=USERNAME,password=PASSWORD,domain=HOME.lan //192.168.18.1/share/homeassistant-media/ /media/video

Script for the containers are as below:

#! /bin/bash
echo "This script is executed in the homeassistant container"; 
/bin/bash /config/startup/startup.d/mount_srm_usb_shares.sh
env;

Logs for frigate have only the line I’ve pasted in the prior message.
Logs for homeassistant appear to be running as they should, but frigate itself is always using the host drive instead.

Is this addon capable of permanently (on every start - surviving addon restarts and addon updates) creating a mount point in a particular addon (specifically addon_core_deconz)?

That’s the idea. It runs when this addon starts. So as long as all the containers restart together, it should work well.

Hey, for frigate, you need /usr/bin/bash shebang. Read at the top of this post. I forgot about that.

That’s not the case. If I update that particular addon or restart only this single addon - will “Run On Startup.d” kick in and do it’s job? Or is it “only” run once the host starts up?

Only when the host or this addon starts/restarts. I don’t have a way to monitor and react to container restarts. It’s a bash script though, maybe someone cleaver could come up with something.

Is it possible to create an automation like "If addon addon_core_deconz starts, restart addon Run On Startup.d"? Supervisor should be aware of addon/container states, right?

Yep. It should be. The trick there would be to make sure it only runs once on startup. Even when the supervisor is doing its initial startup. You might be able to disable start at boot, and just use the supervisor signal.

I’m not sure how it would work. If you would, please follow up with that. Seems like something that should be useful for others, and could be linked into the first post.