Next: , Previous: Host configuration variables, Up: Configuration files   [Contents][Index]


4.4.3 Scripts

Apart from reading the server and host configuration files, tinc can also run scripts at certain moments. Under Windows (not Cygwin), the scripts should have the extension .bat or .cmd.

C:/Program Files/tinc/netname/tinc-up

This is the most important script. If it is present it will be executed right after the tinc daemon has been started and has connected to the virtual network device. It should be used to set up the corresponding network interface, but can also be used to start other things. Under Windows you can use the Network Connections control panel instead of creating this script.

C:/Program Files/tinc/netname/tinc-down

This script is started right before the tinc daemon quits.

C:/Program Files/tinc/netname/hosts/host-up

This script is started when the tinc daemon with name host becomes reachable.

C:/Program Files/tinc/netname/hosts/host-down

This script is started when the tinc daemon with name host becomes unreachable.

C:/Program Files/tinc/netname/host-up

This script is started when any host becomes reachable.

C:/Program Files/tinc/netname/host-down

This script is started when any host becomes unreachable.

C:/Program Files/tinc/netname/subnet-up

This script is started when a Subnet becomes reachable. The Subnet and the node it belongs to are passed in environment variables.

C:/Program Files/tinc/netname/subnet-down

This script is started when a Subnet becomes unreachable.

C:/Program Files/tinc/netname/invitation-created

This script is started when a new invitation has been created.

C:/Program Files/tinc/netname/invitation-accepted

This script is started when an invitation has been used.

The scripts are started without command line arguments, but can make use of certain environment variables. Under UNIX like operating systems the names of environment variables must be preceded by a $ in scripts. Under Windows, in .bat or .cmd files, they have to be put between % signs.

NETNAME

If a netname was specified, this environment variable contains it.

NAME

Contains the name of this tinc daemon.

DEVICE

Contains the name of the virtual network device that tinc uses.

INTERFACE

Contains the name of the virtual network interface that tinc uses. This should be used for commands like ifconfig.

NODE

When a host becomes (un)reachable, this is set to its name. If a subnet becomes (un)reachable, this is set to the owner of that subnet.

REMOTEADDRESS

When a host becomes (un)reachable, this is set to its real address.

REMOTEPORT

When a host becomes (un)reachable, this is set to the port number it uses for communication with other tinc daemons.

SUBNET

When a subnet becomes (un)reachable, this is set to the subnet.

WEIGHT

When a subnet becomes (un)reachable, this is set to the subnet weight.

INVITATION_FILE

When the invitation-created script is called, this is set to the file where the invitation details will be stored.

INVITATION_URL

When the invitation-created script is called, this is set to the invitation URL that has been created.

Do not forget that under UNIX operating systems, you have to make the scripts executable, using the command ‘chmod a+x script’.


Next: , Previous: Host configuration variables, Up: Configuration files   [Contents][Index]