mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 06:25:34 +00:00
[#2914] extended documentation with for loops in scripts
This commit is contained in:
@@ -85,7 +85,7 @@ An example of a script implementing all hook points is presented below:
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
unknown_handle() {
|
unknown_handle() {
|
||||||
echo "Unhandled function call ${*}"
|
echo "Unhandled function call ${*}"
|
||||||
@@ -625,3 +625,39 @@ at 0.
|
|||||||
LEASE6_PREFERRED_LIFETIME
|
LEASE6_PREFERRED_LIFETIME
|
||||||
LEASE6_PREFIX_LEN
|
LEASE6_PREFIX_LEN
|
||||||
LEASE6_TYPE
|
LEASE6_TYPE
|
||||||
|
|
||||||
|
The leases4_committed hook point needs for loops to handle the list of addresses.
|
||||||
|
This can be achived in the following way:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
leases4_committed() {
|
||||||
|
for i in $(seq 0 $((LEASES4_SIZE-1))); do
|
||||||
|
LEASE4_ADDRESS=$(eval "echo \$LEASES4_AT${i}_ADDRESS")
|
||||||
|
...
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in $(seq 0 $((DELETED_LEASES4_SIZE-1))); do
|
||||||
|
DELETED_LEASE4_ADDRESS=$(eval "echo \$DELETED_LEASES4_AT${i}_ADDRESS")
|
||||||
|
...
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
The leases6_committed hook point needs for loops to handle the list of addresses.
|
||||||
|
This can be achived in the following way:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
leases6_committed() {
|
||||||
|
for i in $(seq 0 $((LEASES6_SIZE-1))); do
|
||||||
|
LEASE6_ADDRESS=$(eval "echo \$LEASES6_AT${i}_ADDRESS")
|
||||||
|
...
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in $(seq 0 $((DELETED_LEASES6_SIZE-1))); do
|
||||||
|
DELETED_LEASE6_ADDRESS=$(eval "echo \$DELETED_LEASES6_AT${i}_ADDRESS")
|
||||||
|
...
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
}
|
@@ -101,7 +101,7 @@ the hook point.
|
|||||||
An example of a script implementing all hook points is presented below.
|
An example of a script implementing all hook points is presented below.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
unknown_handle() {
|
unknown_handle() {
|
||||||
echo "Unhandled function call ${*}"
|
echo "Unhandled function call ${*}"
|
||||||
@@ -666,6 +666,46 @@ LEASE6_TYPE
|
|||||||
|
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
The leases4_committed hook point needs for loops to handle the list of addresses.
|
||||||
|
This can be achived in the following way:
|
||||||
|
|
||||||
|
@code
|
||||||
|
|
||||||
|
leases4_committed() {
|
||||||
|
for i in $(seq 0 $((LEASES4_SIZE-1))); do
|
||||||
|
LEASE4_ADDRESS=$(eval "echo \$LEASES4_AT${i}_ADDRESS")
|
||||||
|
...
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in $(seq 0 $((DELETED_LEASES4_SIZE-1))); do
|
||||||
|
DELETED_LEASE4_ADDRESS=$(eval "echo \$DELETED_LEASES4_AT${i}_ADDRESS")
|
||||||
|
...
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The leases6_committed hook point needs for loops to handle the list of addresses.
|
||||||
|
This can be achived in the following way:
|
||||||
|
|
||||||
|
@code
|
||||||
|
|
||||||
|
leases6_committed() {
|
||||||
|
for i in $(seq 0 $((LEASES6_SIZE-1))); do
|
||||||
|
LEASE6_ADDRESS=$(eval "echo \$LEASES6_AT${i}_ADDRESS")
|
||||||
|
...
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in $(seq 0 $((DELETED_LEASES6_SIZE-1))); do
|
||||||
|
DELETED_LEASE6_ADDRESS=$(eval "echo \$DELETED_LEASES6_AT${i}_ADDRESS")
|
||||||
|
...
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
@endcode
|
||||||
|
|
||||||
@section libdhcp_run_scriptMTCompatibility Multi-Threading Compatibility
|
@section libdhcp_run_scriptMTCompatibility Multi-Threading Compatibility
|
||||||
|
|
||||||
The Run Script hooks library is compatible with multi-threading.
|
The Run Script hooks library is compatible with multi-threading.
|
||||||
|
Reference in New Issue
Block a user