Skip to content

Instantly share code, notes, and snippets.

@muxueqz
Created April 1, 2019 06:42
Show Gist options
  • Save muxueqz/e44cc666c24363d22250be306bca17c3 to your computer and use it in GitHub Desktop.
Save muxueqz/e44cc666c24363d22250be306bca17c3 to your computer and use it in GitHub Desktop.
v2ray init script for OpenWRT
#!/bin/sh /etc/rc.common
# Copyright (C) 2013 OpenWrt.org
USE_PROCD=1
START=99
STOP=99
# SERVICE_DAEMONIZE=1
# SERVICE_WRITE_PID=1
CONF=/etc/v2ray_config.pb
EXEC=/usr/bin/v2ray
start_service() {
procd_open_instance
procd_set_param command $EXEC -config $CONF
procd_set_param file $CONF
procd_set_param user v2ray
# procd_set_param respawn # respawn automatically if something died, be careful if you have an alternative process supervisor
procd_close_instance
}
start() {
service_start $EXEC
}
stop() {
service_stop $EXEC
}
reload() {
service_reload $EXEC
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment