mirror of https://github.com/v2ray/v2ray-core
prevent systemd from restarting when configuration error
parent
c0e37ef34a
commit
8b8ae8342b
|
@ -105,7 +105,8 @@ func main() {
|
|||
server, err := startV2Ray()
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(-1)
|
||||
// Configuration error. Exit with a special value to prevent systemd from restarting.
|
||||
os.Exit(23)
|
||||
}
|
||||
|
||||
if *test {
|
||||
|
|
|
@ -13,6 +13,7 @@ Type=simple
|
|||
PIDFile=/var/run/v2ray.pid
|
||||
ExecStart=/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=23 # Configuration error
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
Loading…
Reference in New Issue