Commit 79cdae92 authored by Vitaly Lipatov's avatar Vitaly Lipatov

route-update.sh: add --help with detailed parameter descriptions

parent d8d93ef2
......@@ -6,6 +6,7 @@
# route-update.sh --add IP|DOMAIN GROUP
# route-update.sh --del IP|DOMAIN GROUP
# route-update.sh --flush GROUP
# route-update.sh --help
cd "$(dirname "$(realpath "$0")")" || exit
......@@ -27,6 +28,61 @@ ADD_DEL_TARGET=
ADD_DEL_GROUP=
FLUSH_GROUP=
show_help()
{
cat <<'HELP'
route-update.sh — declarative policy routing via directory-based config
Reads routes.d/ (IPv4) and routes6.d/ (IPv6) directories. Each subdirectory
is a route group containing gateway, table, and .list symlink files.
MODES OF OPERATION:
(no args) Process all groups, skip unchanged (default mode).
Detects changes via MD5 hash of .list + gateway + table files.
Automatically reloads groups if ip rules/routes are lost
or route count drops more than 1% from expected.
--resolve Re-resolve DNS in all groups. Routes are reloaded only
if resolved IPs actually changed.
--force Reload all groups unconditionally (flush + reload).
--show Dry-run: show what would be done without making changes.
Can be combined with other flags.
--set-rules Only create ip rules for all groups (no route loading).
Useful after network restart to restore rules quickly.
--flush GROUP Flush all routes in the specified group's table and exit.
--add IP|DOMAIN GROUP
Add a route for IP or domain to the group immediately.
Domains are resolved to IPs first. Does not modify .list files.
--del IP|DOMAIN GROUP
Remove a route for IP or domain from the group's table.
--verbose, -v Show detailed progress: hashes, route counts, skip reasons.
Can be combined with any mode.
--help, -h Show this help and exit.
DIRECTORY STRUCTURE:
routes.d/GROUP/gateway Gateway IP(s), one per line. "default" = default gw.
Multiple lines = multipath (per-flow balancing).
routes.d/GROUP/table Routing table number. ip rule pref = table × 10.
routes.d/GROUP/*.list Symlinks to files with IPs, subnets, or domains.
routes6.d/ Same structure for IPv6 groups.
EXAMPLES:
./route-update.sh # normal run
./route-update.sh --resolve -v # re-resolve DNS, verbose
./route-update.sh --add example.com egw
./route-update.sh --flush ogw
HELP
exit 0
}
while [ -n "$1" ] ; do
case "$1" in
--force) FORCE=1 ;;
......@@ -34,6 +90,7 @@ while [ -n "$1" ] ; do
--show) SHOW=1 ;;
--set-rules) SET_RULES=1 ;;
--verbose|-v) VERBOSE=1 ;;
--help|-h) show_help ;;
--flush) FLUSH_GROUP="$2" ; shift ;;
--add) ACTION=add ; ADD_DEL_TARGET="$2" ; ADD_DEL_GROUP="$3" ; shift 2 ;;
--del) ACTION=del ; ADD_DEL_TARGET="$2" ; ADD_DEL_GROUP="$3" ; shift 2 ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment