From 2078ee78f437d9ded7b7914e2c4ff960896b3153 Mon Sep 17 00:00:00 2001 From: xtaci Date: Wed, 17 Jul 2024 00:45:31 +0800 Subject: [PATCH] fix script --- dist/kcptun.dist | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dist/kcptun.dist b/dist/kcptun.dist index b96f73dc2..8eaf520b8 100755 --- a/dist/kcptun.dist +++ b/dist/kcptun.dist @@ -1,4 +1,9 @@ #!/bin/sh + +# PROVIDE: kcptun +# REQUIRE: LOGIN cleanvar +# KEYWORD: shutdown +# # FreeBSD startup script, rename and put this file to # /usr/local/etc/rc.d/kcptun # and, run: @@ -9,12 +14,12 @@ . /etc/rc.subr name="kcptun" # How the service will be invoked from service -rcvar="${name}_enable" # The variable in rc.conf that will allow this service to run +rcvar="kcptun_enable" # The variable in rc.conf that will allow this service to run load_rc_config $name # Loads the config file, if relevant. +: ${kcptun_enable:="NO"} dir="/home/xtaci" # change this to the directory where kcptun binaries are. -pidfile="$dir/kcptun.pid" -start_cmd="daemon -p $pidfile $dir/client_freebsd_amd64 -c $dir/local-ss.json" -stop_cmd="kill $(cat $pidfile); echo kcptun is not running." +command="$dir/client_freebsd_amd64" +command_args="-c $dir/local-ss.json" run_rc_command "$1"