I wish to propose an update to the hotplug script that works on both the default Gargoyle setup (uclibc), and my custom OpenWRT trunk dual-WAN setup (musl).
The problem with the default script under my custom compile is that whenever the hotplug system reaches 25-ddns, it suspends the execution of other scripts, because the hotplug is waiting for /usr/bin/ddns_gargoyle -P /etc/ddns_providers.conf -C /etc/ddns_gargoyle.conf to finish, which seemed to hang. Killing the process resumes hotplug execution of other scripts.
I haven't done any deeper look into what might be the cause for the hang (could be some musl libc thing), but I found that I could improve the hotplug script as follows:
Code: Select all
#!/bin/sh
[ "$ACTION" = "ifup" ] && /etc/init.d/ddns_gargoyle enabled || exit 0
[ "$INTERFACE" = "wan" ] && [ -f /var/run/ddns_updaterd.pid ] && /usr/bin/ddns_gargoyle
qos-scripts, ddns-scripts, sqm-scripts, miniupnpd, and privoxy, to name a few, understand this and have checks in their hotplug scripts to not start a service if said service is disabled.
If you will notice ddns_gargoyle --help:
Code: Select all
USAGE: ddns_gargoyle [OPTIONS] [SERVICE NAMES]
-C [SERVICE_CONFIG_FILE] specifies location of file containing configuration information
-P [SERVICE_PROVIDER_FILE] specifies location of file containing service provider definitions
-d start daemon mode
-f forces update for standalone or when daemon first starts -- default is just to check and update if necessary
-h for non-daemon mode display output in human readable format
-m for non-daemon mode display output in simple machine parsable format: a list of numbers, one for each service
where 0=failure to update, 1= update not needed, 2=success
-u print usage and exit
Just calling the binary WITHOUT any further parameters is sufficient, as it communicates with the already running daemon, which is started with the appropriate -C and -P service files parameters, and it instructs the daemon to either check or force an update depending upon whether -f is passed to it.
I added an additional check in the hotplug script to make sure that the daemon is running before calling ddns_gargoyle, for good measure.
Like I said, this works in Gargoyle and OpenWRT trunk, no matter if having multi-WAN or not. Also, ddns_gargoyle compiles successfully using musl libc.
I'm sharing my changes, hoping that it benefits the community and improves Gargoyle in general.
