mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 17:05:13 +08:00
🌈 Sync 2026-07-25 08:33:42
This commit is contained in:
1 parent
7380e71a3b
commit
971b549a31
12 files changed
+396
-39
No files matched your search
+8
-4
@@ -82,6 +82,8 @@ optimize_cpu_cores() {
|
||||
|
||||
start_instance() {
|
||||
local enable key host port dev mptcp proto chacha20 mode multiqueue cpu_affinity timeout localip remoteip
|
||||
local key_dir="/var/run/${PROG_NAME}"
|
||||
local key_file="${key_dir}/${1}.key"
|
||||
|
||||
validate_section "${1}" || {
|
||||
_err "validation failed"
|
||||
@@ -102,8 +104,10 @@ start_instance() {
|
||||
[ -n "${dev}" ] || return 1
|
||||
[ -n "${host}" ] || return 1
|
||||
|
||||
echo "${key}" > /tmp/${PROG_NAME}-${1}.key
|
||||
[ -f "/tmp/${PROG_NAME}-${1}.key" ] || {
|
||||
mkdir -p "$key_dir"
|
||||
chmod 0700 "$key_dir"
|
||||
( umask 077; printf '%s\n' "$key" > "$key_file" )
|
||||
[ -f "$key_file" ] || {
|
||||
_err "can't create key file"
|
||||
return 1
|
||||
}
|
||||
@@ -119,7 +123,7 @@ start_instance() {
|
||||
procd_open_instance
|
||||
|
||||
procd_set_param command ${PROG} \
|
||||
keyfile /tmp/${PROG_NAME}-${1}.key \
|
||||
keyfile "$key_file" \
|
||||
${port:+port "$port"} \
|
||||
${host:+host "$host"} \
|
||||
${dev:+dev "$dev"}
|
||||
@@ -137,7 +141,7 @@ start_instance() {
|
||||
|
||||
procd_set_param respawn 0 30 0
|
||||
procd_set_param nice 10
|
||||
procd_set_param file /tmp/${PROG_NAME}-${1}.key
|
||||
procd_set_param file "$key_file"
|
||||
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
Reference in new issue
Block a user