Prechádzať zdrojové kódy

Make --run option the default (and not optional)

Bump version to 2.0.1
Ask Bjørn Hansen 13 rokov pred
rodič
commit
7b3a8a817a
2 zmenil súbory, kde vykonal 15 pridanie a 17 odobranie
  1. 14 16
      geodns.go
  2. 1 1
      service/run

+ 14 - 16
geodns.go

@@ -11,7 +11,7 @@ import (
 	"time"
 )
 
-var VERSION string = "2.0"
+var VERSION string = "2.0.1"
 var gitVersion string
 var serverId string
 
@@ -23,7 +23,6 @@ var (
 	flaginter  = flag.String("interface", "*", "set the listener address")
 	flagport   = flag.String("port", "53", "default port number")
 	flaglog    = flag.Bool("log", false, "be more verbose")
-	flagrun    = flag.Bool("run", false, "run server")
 
 	cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
 	memprofile = flag.String("memprofile", "", "write memory profile to this file")
@@ -91,22 +90,21 @@ func main() {
 		go listenAndServe(host, &Zones)
 	}
 
-	if *flagrun {
-		terminate := make(chan os.Signal)
-		signal.Notify(terminate, os.Interrupt)
+	terminate := make(chan os.Signal)
+	signal.Notify(terminate, os.Interrupt)
 
-		<-terminate
-		log.Printf("geodns: signal received, stopping")
+	<-terminate
+	log.Printf("geodns: signal received, stopping")
 
-		if *memprofile != "" {
-			f, err := os.Create(*memprofile)
-			if err != nil {
-				log.Fatal(err)
-			}
-			pprof.WriteHeapProfile(f)
-			f.Close()
+	if *memprofile != "" {
+		f, err := os.Create(*memprofile)
+		if err != nil {
+			log.Fatal(err)
 		}
-
-		//os.Exit(0)
+		pprof.WriteHeapProfile(f)
+		f.Close()
 	}
+
+	//os.Exit(0)
+
 }

+ 1 - 1
service/run

@@ -3,4 +3,4 @@ exec 2>&1
 cd /opt/geodns
 IP=`head -1 env/IP`
 CONFIG=`head -1 env/CONFIG`
-exec softlimit -d500000000 ./geodns --interface="$IP" --config="$CONFIG" --run
+exec softlimit -d500000000 ./geodns --interface="$IP" --config="$CONFIG"