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