1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-09 17:30:44 +00:00

prevent systemd from restarting when configuration error

This commit is contained in:
Darien Raymond 2018-07-17 11:53:36 +02:00
parent c0e37ef34a
commit 8b8ae8342b
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 3 additions and 1 deletions

View File

@ -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 {

View File

@ -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