From: Sergey Matveev Date: Mon, 7 Mar 2016 12:02:35 +0000 (+0300) Subject: Execute all down script when server is terminated X-Git-Tag: 5.7^2~3 X-Git-Url: http://www.git.cypherpunks.ru/?p=govpn.git;a=commitdiff_plain;h=e71bc62b4fbeeb9862b30b4f2ef71ae6036c61d4 Execute all down script when server is terminated --- diff --git a/src/cypherpunks.ru/govpn/cmd/govpn-server/main.go b/src/cypherpunks.ru/govpn/cmd/govpn-server/main.go index 0c385c7..5cddab8 100644 --- a/src/cypherpunks.ru/govpn/cmd/govpn-server/main.go +++ b/src/cypherpunks.ru/govpn/cmd/govpn-server/main.go @@ -89,6 +89,14 @@ MainCycle: for { select { case <-termSignal: + log.Println("Terminating") + for _, ps := range peers { + govpn.ScriptCall( + confs[*ps.peer.Id].Down, + ps.tap.Name, + ps.peer.Addr, + ) + } break MainCycle case <-hsHeartbeat: now := time.Now()