mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-07-27 18:41:15 +08:00
43 lines
1.0 KiB
Bash
Executable File
43 lines
1.0 KiB
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
|
|
USE_PROCD=1
|
|
START=90
|
|
STOP=10
|
|
|
|
NAME=opera-proxy
|
|
PROG=/usr/bin/${NAME}
|
|
|
|
start_service() {
|
|
local country bind_address verbosity socks_mode timeout
|
|
|
|
config_load opera-proxy
|
|
config_get country main country "EU"
|
|
config_get bind_address main bind_address "127.0.0.1:18080"
|
|
config_get verbosity main verbosity "20"
|
|
config_get timeout main timeout "10s"
|
|
config_get_bool socks_mode main socks_mode 0
|
|
|
|
procd_open_instance
|
|
procd_set_param command "$PROG"
|
|
procd_append_param command -country "$country"
|
|
procd_append_param command -bind-address "$bind_address"
|
|
procd_append_param command -verbosity "$verbosity"
|
|
procd_append_param command -timeout "$timeout"
|
|
|
|
[ "$socks_mode" = "1" ] && procd_append_param command -socks-mode
|
|
|
|
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
}
|
|
|
|
reload_service() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
service_triggers() {
|
|
procd_add_reload_trigger "opera-proxy"
|
|
}
|