...

Source file src/go.etcd.io/etcd/server/v3/etcdmain/main.go

Documentation: go.etcd.io/etcd/server/v3/etcdmain

     1  // Copyright 2015 The etcd Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package etcdmain
    16  
    17  import (
    18  	"fmt"
    19  	"os"
    20  
    21  	"github.com/coreos/go-systemd/v22/daemon"
    22  	"go.uber.org/zap"
    23  )
    24  
    25  func Main(args []string) {
    26  	checkSupportArch()
    27  
    28  	if len(args) > 1 {
    29  		cmd := args[1]
    30  		switch cmd {
    31  		case "gateway", "grpc-proxy":
    32  			if err := rootCmd.Execute(); err != nil {
    33  				fmt.Fprint(os.Stderr, err)
    34  				os.Exit(1)
    35  			}
    36  			return
    37  		}
    38  	}
    39  
    40  	startEtcdOrProxyV2(args)
    41  }
    42  
    43  func notifySystemd(lg *zap.Logger) {
    44  	lg.Info("notifying init daemon")
    45  	_, err := daemon.SdNotify(false, daemon.SdNotifyReady)
    46  	if err != nil {
    47  		lg.Error("failed to notify systemd for readiness", zap.Error(err))
    48  		return
    49  	}
    50  	lg.Info("successfully notified init daemon")
    51  }
    52  

View as plain text