[SOLVED] reactor_inet_check script... and containers
-
When on my bare metal RPi with MSR I had a rule that ran every minute to check Internet status via a script in MSR called
reactor_inet_check.sh
I've moved to containerized MSR and see in the instructions that this cannot be run from the container.
The script cannot run within the Reactor docker container. If you are using Reactor in a docker container, the script needs to be run by cron or an equivalent facility on the host system (e.g. some systems, like Synology NAS, have separate task managers that may be used to schedule the repeated execution of tasks such as this).
I've put a script on my container host that calls the
reator_inet_check.sh
script and it isn't erroring... but I still see the internet status within MSR asnull
.Before I go diving down the rabbit hole... should this work?
-
toggledbitswrote on Jan 18, 2025, 5:03 PM last edited by toggledbits Jan 18, 2025, 12:06 PM
OK, first, please don't screen shot text, especially code, logs, and scripts. Learn to use fenced code blocks: put three back-ticks ``` on a line by itself, then follow with the text, the close with another three back-ticks ``` on a line by itself. When formatted, it will look like this:
#!/bin/bash # Execute the script inside the container pct exec 101 -- bash -c "cd /home/reactor/reactor;./reactor_inet_check.sh"
The path for the script is suspicious and likely wrong. The
reactor_inet_check.sh
script has to be run from the Reactor install directory, and doing so would give you a script run path of./tools/reactor_inet_check.sh
. The script is built to run only this way. That's in the script header's instructions.But also, you are trying to run the script from the Proxmox host, which I guess you can do, but it's unnecessarily hard and makes the configuration dependent on the VMID. I recommend that you run it from Ubuntu. All that's required is this in your Ubuntu root
crontab
:* * * * cd /home/reactor && ./tools/reactor_inet_check.sh
The Ubuntu
/var/log/syslog
should have information about the success of those runs.If you're using Reactor access control (i.e. you are configured to required login to access Reactor), you probably will also need to add an ACL to permit the script to use the API.
-
gwp1replied to toggledbits on Jan 18, 2025, 6:03 PM last edited by gwp1 Jan 18, 2025, 1:21 PM
@toggledbits I know how to tick code - I just didn't think at that hour it would be necessary. Apologies.
Because, YES, trying to configure this from the Proxmox host is devilish, I've added this now to Unbuntu root
crontab
with:sudo crontab -e # MSR script to perform internet check every minute * * * * * cd /home/reactor/reactor && tools/reactor_inet_check.sh
Looking into the ACL now as I do have Access Control enabled.EDIT
Taking things in smaller bites... I've renamed
users.yaml
so Access Control is disabled. Let's start easyCron is running. To me, this reads like it's running just fine.
2025-01-18T13:08:01.129250-05:00 msr CRON[21717]: (root) CMD (cd /home/reactor/reactor && tools/reactor_inet_check.sh) 2025-01-18T13:09:01.161220-05:00 msr CRON[21737]: (root) CMD (cd /home/reactor/reactor && tools/reactor_inet_check.sh) 2025-01-18T13:10:01.223057-05:00 msr CRON[21769]: (root) CMD (cd /home/reactor/reactor && tools/reactor_inet_check.sh) 2025-01-18T13:10:18.126046-05:00 msr systemd[1]: Starting sysstat-collect.service - system activity accounting tool... 2025-01-18T13:10:18.131608-05:00 msr systemd[1]: sysstat-collect.service: Deactivated successfully. 2025-01-18T13:10:18.131786-05:00 msr systemd[1]: Finished sysstat-collect.service - system activity accounting tool. 2025-01-18T13:11:01.254645-05:00 msr CRON[21797]: (root) CMD (cd /home/reactor/reactor && tools/reactor_inet_check.sh) 2025-01-18T13:12:01.315036-05:00 msr CRON[21821]: (root) CMD (cd /home/reactor/reactor && tools/reactor_inet_check.sh) 2025-01-18T13:13:01.347216-05:00 msr CRON[21844]: (root) CMD (cd /home/reactor/reactor && tools/reactor_inet_check.sh)
Looking at the Reactor System
Entity
, however, I still seereactor_system.internet_ok=null
-
@toggledbits Most days I'm not very smart... but I'm stubborn.
This is working.
It has kept working thru multiple MSR restarts. (I have not yet tested a container restart.)
I'm not 100% sure why it's working, tbh. I think one more MSR restart cleared the cobwebs and it was suddenly fine. I then added an ACL before putting back Access Control which brings me to...
I also have Access Control back in place and using a hashed pwd (which for some reason eluded me when I tried to enable it previously.)
On this day we're calling it "Two steps back, three forward."
Thanks for your help as always.
-
@gwp1 said in [SOLVED] reactor_inet_check script... and containers:
Most days I'm not very smart... but I'm stubborn.
It's good to know I'm in good company.
-
A worthy quality
C
-
Oooh thanks!
C