Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
userdoc:tt-dhcpv6-prefix-delegation [2017/06/07 10:19]
abelbeck [DHCPv6 Client Action Script]
userdoc:tt-dhcpv6-prefix-delegation [2017/06/07 10:20] (current)
abelbeck [DHCPv6 Client Action Script]
Line 74: Line 74:
 The ''​dhcp6c_changed''​ variable can be empty if there was no previous ''​dhcp6c_cache''​ file to compare, ''"​yes"''​ if different from previous, and ''"​no"''​ if the same as previous. ​ The most common use case would be to compare ''​dhcp6c_changed''​ with ''"​no"''​ to skip operations that have been previously performed. The ''​dhcp6c_changed''​ variable can be empty if there was no previous ''​dhcp6c_cache''​ file to compare, ''"​yes"''​ if different from previous, and ''"​no"''​ if the same as previous. ​ The most common use case would be to compare ''​dhcp6c_changed''​ with ''"​no"''​ to skip operations that have been previously performed.
  
-As an example, a simple script to log when the DHCPv6 lease is updated and whether it changed:+As an example, a simple script to log when the DHCPv6 lease is updated and whether it changed:\\
 !!Note ->!! Occurs by default with AstLinux 1.3.0 or later !!Note ->!! Occurs by default with AstLinux 1.3.0 or later
  
   #!/bin/bash   #!/bin/bash
   ​   ​
-  ​if [ -n "​$dhcp6c_prefix"​ ]; then +  case "​$dhcp6c_changed"​ in 
-    ​case "​$dhcp6c_changed"​ in +    yes) changed="​ (changed)"​ ;; 
-      yes) changed="​ (changed)"​ ;; +     ​no) changed="​ (no change)"​ ;; 
-       ​no) changed="​ (no change)"​ ;; +      *) changed=""​ ;; 
-        *) changed=""​ ;; +  esac 
-    esac +  logger -t dhcp6c -p kern.info "IPv6 Prefix$changed:​ $dhcp6c_prefix"​ 
-    logger -t dhcp6c -p kern.info "IPv6 Prefix$changed:​ $dhcp6c_prefix"​ +
-  fi+
 ===== Debugging DHCPv6 ===== ===== Debugging DHCPv6 =====