File tree 2 files changed +78
-2
lines changed
src/hooks/dhcp/run_script
2 files changed +78
-2
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ An example of a script implementing all hook points is presented below:
85
85
86
86
::
87
87
88
- #!/bin/bash
88
+ #!/bin/sh
89
89
90
90
unknown_handle() {
91
91
echo "Unhandled function call ${*}"
@@ -625,3 +625,39 @@ at 0.
625
625
LEASE6_PREFERRED_LIFETIME
626
626
LEASE6_PREFIX_LEN
627
627
LEASE6_TYPE
628
+
629
+ The leases4_committed hook point needs for loops to handle the list of addresses.
630
+ This can be achived in the following way:
631
+
632
+ ::
633
+
634
+ leases4_committed() {
635
+ for i in $(seq 0 $((LEASES4_SIZE-1))); do
636
+ LEASE4_ADDRESS=$(eval "echo \$LEASES4_AT${i}_ADDRESS")
637
+ ...
638
+ done
639
+
640
+ for i in $(seq 0 $((DELETED_LEASES4_SIZE-1))); do
641
+ DELETED_LEASE4_ADDRESS=$(eval "echo \$DELETED_LEASES4_AT${i}_ADDRESS")
642
+ ...
643
+ done
644
+ exit 0
645
+ }
646
+
647
+ The leases6_committed hook point needs for loops to handle the list of addresses.
648
+ This can be achived in the following way:
649
+
650
+ ::
651
+
652
+ leases6_committed() {
653
+ for i in $(seq 0 $((LEASES6_SIZE-1))); do
654
+ LEASE6_ADDRESS=$(eval "echo \$LEASES6_AT${i}_ADDRESS")
655
+ ...
656
+ done
657
+
658
+ for i in $(seq 0 $((DELETED_LEASES6_SIZE-1))); do
659
+ DELETED_LEASE6_ADDRESS=$(eval "echo \$DELETED_LEASES6_AT${i}_ADDRESS")
660
+ ...
661
+ done
662
+ exit 0
663
+ }
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ the hook point.
101
101
An example of a script implementing all hook points is presented below.
102
102
103
103
@code
104
- #!/bin/bash
104
+ #!/bin/sh
105
105
106
106
unknown_handle() {
107
107
echo "Unhandled function call ${*}"
@@ -666,6 +666,46 @@ LEASE6_TYPE
666
666
667
667
@endcode
668
668
669
+ The leases4_committed hook point needs for loops to handle the list of addresses.
670
+ This can be achived in the following way:
671
+
672
+ @code
673
+
674
+ leases4_committed() {
675
+ for i in $(seq 0 $((LEASES4_SIZE-1))); do
676
+ LEASE4_ADDRESS=$(eval "echo \$LEASES4_AT${i}_ADDRESS")
677
+ ...
678
+ done
679
+
680
+ for i in $(seq 0 $((DELETED_LEASES4_SIZE-1))); do
681
+ DELETED_LEASE4_ADDRESS=$(eval "echo \$DELETED_LEASES4_AT${i}_ADDRESS")
682
+ ...
683
+ done
684
+ exit 0
685
+ }
686
+
687
+ @endcode
688
+
689
+ The leases6_committed hook point needs for loops to handle the list of addresses.
690
+ This can be achived in the following way:
691
+
692
+ @code
693
+
694
+ leases6_committed() {
695
+ for i in $(seq 0 $((LEASES6_SIZE-1))); do
696
+ LEASE6_ADDRESS=$(eval "echo \$LEASES6_AT${i}_ADDRESS")
697
+ ...
698
+ done
699
+
700
+ for i in $(seq 0 $((DELETED_LEASES6_SIZE-1))); do
701
+ DELETED_LEASE6_ADDRESS=$(eval "echo \$DELETED_LEASES6_AT${i}_ADDRESS")
702
+ ...
703
+ done
704
+ exit 0
705
+ }
706
+
707
+ @endcode
708
+
669
709
@section libdhcp_run_scriptMTCompatibility Multi-Threading Compatibility
670
710
671
711
The Run Script hooks library is compatible with multi-threading.
You can’t perform that action at this time.
0 commit comments