Skip to content

Instantly share code, notes, and snippets.

@rogerlin0330
Created July 21, 2019 07:34
Show Gist options
  • Save rogerlin0330/7823c8db35c32d9bcfa646060e098702 to your computer and use it in GitHub Desktop.
Save rogerlin0330/7823c8db35c32d9bcfa646060e098702 to your computer and use it in GitHub Desktop.
Server service sample for v2ray (https://github.com/v2ray/v2ray-core) which should be located in path: /usr/lib/systemd/system.
[Unit]
Description=V2Ray Service
After=network.target
Wants=network.target
[Service]
# This service runs as root. You may consider to run it as another user for security concerns.
# By uncommenting the following two lines, this service will run as user v2ray/v2ray.
# More discussion at https://github.com/v2ray/v2ray-core/issues/1011
# User=v2ray
# Group=v2ray
Type=simple
PIDFile=/run/v2ray.pid
Environment=V2RAY_LOCATION_ASSET=/etc/v2ray
ExecStart=/usr/bin/v2ray -config /etc/v2ray/config.json
Restart=on-failure
# Don't restart in the case of configuration error
RestartPreventExitStatus=23
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment