Till now I got stuck here
From the beginning:
- I added a new file to devd (homeassistant.conf), which have the following lines:
Code:
notify 101 {
match "system" "IFNET";
match "type" "LINK_DOWN";
media-type "ethernet";
action "/usr/local/bin/homeassistant/wan1_down.sh";
};
- After that, I created the script 'wan1_down.sh' to '/usr/local/bin/homeassistant/' with +x chmod
The script is working very fine if I run it manually, but when you wait for 'devd' to do its job, it is not working.
I tested more and I have stopped the devd service, then I run the 'devd -d', in order to see what is happening into the console, and I had a very big surprise, 'devd' was working flowless, the script have been loaded, the notification to home assistant was there, all good.
Now, the problem is that 'devd' won't run the script if is loaded as service, only if I run it manually 'devd -d', will work. Why? And how can I made it work as service as well?
Another problem which I had even when devd was loaded manually, if I use 'notify' less than 101, the script won't run. But I understood that it is not running because another 'devd' config file, have an action with priority 101 and won't let anything else to take action. Still, how can I run the script with any priority? Or how can I add two actions into the same action?
Edit: Ok, I have found a temporary solution to run multiple actions, but I don't know that this is the proper way. I just added a secondary 'action" line, to the same notify. Is this ok? I thought that devd can run multiple actions for a similar notify...
Edit2: Seems that 'devd' it is working as service too, but it won't take action if I use 'ifconfig pppoe0 down', instead of this, it is working if I take out the cable or I use this 'ifconfig igc1 down/up'
>>Edit2: In this moment, everything works well, I just need some explication about the 'notify' from devd.conf. Why devd is not loading two similar notify, but with different actions? It is only loading one, and it is always the one with higher priority. Ok, I can understand that higher priority is the real deal, but I thought that the 'nofity' codes are loaded secvential, regarding the priority, not only the one with higher priority...