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