Add generic host-up and host-down scripts.

Thanks to Menno Smits for a patch.
This commit is contained in:
Guus Sliepen 2006-06-12 21:45:39 +00:00
parent f88c9942e1
commit 2077451e07
3 changed files with 12 additions and 0 deletions

View file

@ -346,6 +346,10 @@ becomes reachable.
This script is started when the tinc daemon with name This script is started when the tinc daemon with name
.Ar HOST .Ar HOST
becomes unreachable. becomes unreachable.
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /host-up
This script is started when any host becomes reachable.
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /host-down
This script is started when any host becomes unreachable.
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /subnet-up .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /subnet-up
This script is started when a Subnet becomes reachable. This script is started when a Subnet becomes reachable.
The Subnet and the node it belongs to are passed in environment variables. The Subnet and the node it belongs to are passed in environment variables.

View file

@ -1096,6 +1096,12 @@ This script is started when the tinc daemon with name @var{host} becomes reachab
@item @value{sysconfdir}/tinc/@var{netname}/hosts/@var{host}-down @item @value{sysconfdir}/tinc/@var{netname}/hosts/@var{host}-down
This script is started when the tinc daemon with name @var{host} becomes unreachable. This script is started when the tinc daemon with name @var{host} becomes unreachable.
@item @value{sysconfdir}/tinc/@var{netname}/host-up
This script is started when any host becomes reachable.
@item @value{sysconfdir}/tinc/@var{netname}/host-down
This script is started when any host becomes unreachable.
@item @value{sysconfdir}/tinc/@var{netname}/subnet-up @item @value{sysconfdir}/tinc/@var{netname}/subnet-up
This script is started when a Subnet becomes reachable. This script is started when a Subnet becomes reachable.
The Subnet and the node it belongs to are passed in environment variables. The Subnet and the node it belongs to are passed in environment variables.

View file

@ -283,6 +283,8 @@ void sssp_bfs(void)
asprintf(&envp[5], "REMOTEPORT=%s", port); asprintf(&envp[5], "REMOTEPORT=%s", port);
envp[6] = NULL; envp[6] = NULL;
execute_script(n->status.reachable ? "host-up" : "host-down", envp);
asprintf(&name, asprintf(&name,
n->status.reachable ? "hosts/%s-up" : "hosts/%s-down", n->status.reachable ? "hosts/%s-up" : "hosts/%s-down",
n->name); n->name);