mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-03 07:56:42 -05:00
add systemd related config
This commit is contained in:
parent
04e7dc87a8
commit
a6b662b173
13
release/config/systemd/v2ray.service
Normal file
13
release/config/systemd/v2ray.service
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=V2Ray Service
|
||||||
|
After=network.target
|
||||||
|
Wants=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
PIDFile=/var/run/v2ray.pid
|
||||||
|
ExecStart=start-stop-daemon --start --quiet --pidfile /var/run/v2ray.pid --exec /usr/bin/v2ray/v2ray --background -m -- -config /etc/v2ray/config.json
|
||||||
|
ExecStop=start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile /var/run/v2ray.pid
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -46,8 +46,14 @@ if [ ! -f "/etc/v2ray/config.json" ]; then
|
|||||||
echo "UUID:${UUID}"
|
echo "UUID:${UUID}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure SysV if necessary.
|
#if [ -d "/lib/systemd/system" ]; then
|
||||||
if [ -d "/etc/init.d" ]; then
|
# if [ ! -f "/lib/systemd/system/v2ray.service" ]; then
|
||||||
|
# cp "/tmp/v2ray/v2ray-${VER}-linux-${VDIS}/systemd/v2ray.service" "/lib/systemd/system/"
|
||||||
|
# systemctl enable v2ray
|
||||||
|
# fi
|
||||||
|
#el
|
||||||
|
|
||||||
|
if [ -d "/etc/init.d" ]; then # Configure SysV if necessary.
|
||||||
if [ ! -f "/etc/init.d/v2ray" ]; then
|
if [ ! -f "/etc/init.d/v2ray" ]; then
|
||||||
cp "/tmp/v2ray/v2ray-${VER}-linux-${VDIS}/systemv/v2ray" "/etc/init.d/v2ray"
|
cp "/tmp/v2ray/v2ray-${VER}-linux-${VDIS}/systemv/v2ray" "/etc/init.d/v2ray"
|
||||||
chmod +x "/etc/init.d/v2ray"
|
chmod +x "/etc/init.d/v2ray"
|
||||||
|
@ -55,6 +55,15 @@ func copyConfigFiles(dir string, goOS GoOS) error {
|
|||||||
if err := copyConfigFile(src, dest, goOS, false); err != nil {
|
if err := copyConfigFile(src, dest, goOS, false); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := os.MkdirAll(filepath.Join(dir, "systemd"), os.ModeDir|0777); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
src = filepath.Join(srcDir, "systemd", "v2ray.service")
|
||||||
|
dest = filepath.Join(dir, "systemd", "v2ray.service")
|
||||||
|
if err := copyConfigFile(src, dest, goOS, false); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user